#!/bin/bash
while [ `ps -ef | grep firefox-bin` ]
do
codes
done
it says line 2: [: too many arguments
why?
#!/bin/bash
while [ `ps -ef | grep firefox-bin` ]
do
codes
done
it says line 2: [: too many arguments
why?
output of ps is going into test ([) eg:
[ root 2104 1 con 09:05:06 /usr/local/bin/firfox-bin root 2106 2104 con 09:05:06 /usr/local/bin/firfox-bin ]
Perhaps this is something more like what you wanted:
ps -ef | grep firfox-bin | while read ps_line
do
codes (that uses $ps_line)
done
while ( ps -ef | grep firefox-bin | grep -v grep 2>/dev/null )
do
code
done
code will be executed as long as the grep find the pattern in the process list so (i suppose) as long as some firefox processes are found
lolz
i'm really learning alot now. thanks to you both
Or:
while ps -ef | grep -q [f]irefox-bin
do
sleep 10
done
The use of square brackets is important or grep may grep itself.