Hi I need help to whit a script that start a program if a nother program is started first .
I thought something like this .
if [ "ps aux | grep program1" is bigger than 0 ] then start program 2
Thanks
Hi I need help to whit a script that start a program if a nother program is started first .
I thought something like this .
if [ "ps aux | grep program1" is bigger than 0 ] then start program 2
Thanks
c=$(ps aux | grep program1|wc -l)
if [[ "$c" -eq 1 ]]
then
start program 2
fi
the above code will have $c as always one, as grep would be in the list of ps.
so it should be
c=`ps aux|grep program1|grep -v grep|wc -l`
Please correct me if i am wrong
That's the reason I don't use "-eq 0"
if using your code, I have to change the if command to :
if [[ "$c" -eq 0 ]]
sorry rdcwayx.
I was misled.