How to create cronjob using bash

Bash
Does crontab have an argument for creating cronjobs without using the editor (crontab -e). If so, What would be the code create a cronjob from a bash ...
1 year ago

Running python script as root

Bash
I have the following script: #!/usr/bin/env python import sys ...
1 year ago

How to make a script with apt-get commands?

Bash
I'm doing a script which installs a tcl plugin. But this tcl plugin require some additional tcl/tk libraries, so I was thinking about putting an APT...
1 year ago

Count number of lines in a git repository

Bash
How would I count the total number of lines present in all the files in a git repository? git ls-files gives me a list of files tracked by git. I'm ...
1 year ago

Removed semicolon from a line in php.ini using shell command

Bash
I'd like to removed a semicolon from one of these lines in the php.ini using bash shell command (perhaps using sed). How would I do that? ;extension ...
1 year ago

How to restart Meteor

Bash
If I close the browser tab and press Ctrl + Z to exit the current running meteor process, how do I start meteor again to restart the previous project?...
1 year ago

How to set a BASH variable equal to the output from a command?

Bash
I am working on a simple scripting project for work that involves the use of BASH. I have a pretty simple script that is something like the following...
1 year ago

how to insert a line using into a file in alphabetical order using shell script

Bash
How can i insert lines into a file using shell script such that they are inserted in alphabetical order, following would explain better. input file c...
1 year ago

Do I need to generate a second file to sort a file?

Bash
I want to sort a bunch of files. I can do sort file.txt > foo.txt mv foo.txt file.txt but do I need this second file? (I tried sort file.txt &...
1 year ago

Shell one-liner to add a line to a sorted file

Bash
I want to add a line to a text file so that the result is sorted, where the text file was originally sorted. For example: cp file tmp; echo "new lin...
1 year ago

How regular expression assertions can be written in shell script in ubuntu

Bash
The following is a valid regex in many languages, but it doesn't work in bash: ((?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%]).{6,20}) How can I write ...
1 year ago

Mongodb function TypeError

Bash
In the mongo shell, running the following line works fine: director = = 'George Lucas' db.movie.find( { director: director} ).sort( { title: 1 }) ...
1 year ago

Bash: Move files to specific folder if name contains one of a list of strings

Bash
I have a script that queries the Twitter API for several queries, and then writes the raw data to a file with the query in the name, plus a timestamp....
1 year ago

How to check if command exists in a shell script?

Bash
I am writing my first shell script. In my script I would like to check if a certain command exists, and if not, install the executable. How would I ch...
1 year ago

xterm doesn't run shell script

Bash
so I'm trying to use this command: export DISPLAY=:1; /usr/bin/xterm -hold -e /path/to/shscript Where shscript is: #!/bin/bash echo "Restarting .....
1 year ago

How to find rows in a file with same values for specific columns using unix commands?

Bash
I have a file with a large number of rows. Each row contains 5 columns delimited by tabs. I want to find all rows that have the same value for the fir...
1 year ago

How to copy file into subdirectories?

Bash
My script #!/bin/bash for dir in $(/home/milenko/Documents/mt/MT8 -type d -maxdepth 1); do cp -i kop.sh "$dir"/; done But p.sh: line 3: /home/mil...
1 year ago

Shell Script check if file exists, and has read permissions

Bash
In my shell script i'm trying to check if a specific file is exists and if it has reading permissions. My file's path has spaces in it. I quoted the...
1 year ago

Compare two strings in shell, one coming from a command return

Bash
I'd like to compare two strings to know if my Bluetooth is on or off using blueutil I tried this : cd ../../../usr/local/bin ./blueutil status a=$(....
1 year ago

How do you tell if a string contains another string in Unix shell scripting?

Bash
I want to write a Unix shell script that will do various logic if there is a string inside of another string. For example, if I am in a certain folder...
1 year ago