1
vote
1answer
13 views

Linux, code that checks there are no currently running cron jobs?

How would I write a bash script that checks there are no currently running cron jobs, then does some simple action? I am not talking about cron jobs that are scheduled to run at some point, I am ...
0
votes
4answers
43 views

“unary operator expected” in shell script

I need a script to keep polling "receive_dir" directory till "stopfile" get written in the directory. This has to run despite empty directory. So far i have this but fails if receive_dir is empty ...
4
votes
1answer
34 views

order of files unix find on two directories with or command

What is the expected order of the files if one executes the following find command on Linux: mkdir /tmp/dir1 /tmp/dir2 touch /tmp/dir1/1 /tmp/dir1/2 /tmp/dir2/1 /tmp/dir2/2 /tmp/dir2/3 /tmp/dir2/0 ...
2
votes
2answers
19 views

How to prompt to the user while performing a find>replace in unix

I'm trying to write a script that basically works like Microsoft words find>replace function. It first asks for two inputs from the user. First one for strings to be found and the second one for ...
0
votes
2answers
18 views

Customize shell scripts based on environment like development test staging production

I need to customize my shell scripts. I have some environment/properties files in my work space where the shell scripts will have to pick up the respective variables during installation based on the ...
1
vote
2answers
32 views

How do I compile multi-file C++ programs in all subdirectories?

I have a bunch of C++ programs each in its own sub-directory. Each sub-directory has a single C++ program in several files -- a .h and a .cpp file for each class plus a main .cpp program. I want to ...
2
votes
1answer
27 views

What does : ${ROOT_DIR:=“.”} do in a bash script?

I am looking at the following line in a bash script: : ${ROOT_DIR:="."} I believe I understand that the second part is an expansion that sets the ROOT_DIR variable to the current working ...
-1
votes
2answers
54 views

What does “-ne” mean in bash?

What does the command "-ne" mean in a bash script? For instance, what does the following line from a bash script do? [ $RESULT -ne 0 ]
1
vote
3answers
44 views

Why am I getting some extra, weird characters when making a file from grep output?

I am doing a very basic command that never gave me trouble in the past, but is inexplicably returning undesired characters now. I am in BASH on linux, and simply want to search through a directory ...
0
votes
2answers
19 views

MySQL Command not Found [MAMP]

I'm working to set up my MySQL server using MAMP. Current Status: Downloaded MySQL, MAMP Running MAMP: MySQL Server is green, plus it appears as a process in activity monitor I tried: $ mysql ...
1
vote
1answer
31 views

define variable inputs with - parameter for unix

My question is pretty straight forward but it seems like I can't seem to be able to find an answer with google :( How do I specify parameters for a function with - parameter for a function I wrote. ...
-3
votes
0answers
28 views

How do I read a list from file into an array, with a bash script? [duplicate]

I'm looking at a text file with the following format: NOT_AN_ARRAY: value1 NOT_AN_ARRAY2: value2 ARRAY1: item1, item2, item3 ARRAY2: item1, item2, item3 ARRAY3: item1, item2, ...
0
votes
2answers
50 views

Store output in variable & use variable in command

I am trying to run a command and store it in a variable. length=`last | grep foouser | wc -l` It works fine but when I add a variable to the command it breaks. value=$1 length=`last | grep $value ...
0
votes
2answers
52 views

How to tell if a filename is a directory, not a file

I need to check if a parameter passed to a bash script is a folder or a file. It may or may not end with / xpath=$(dirname "$1") strips out the dirname if there was no trailing / Thanks
1
vote
2answers
46 views

What happens if two command line programs share the same name? [on hold]

I've always wondered this, and haven't managed to find a good answer anywhere – what happens if two command line programs aren't namespaced properly and share the same name? How would you call one or ...

1 2 3 4 5 137
15 30 50 per page