PDA

View Full Version : [SOLVED] Bash While Output of a Command



Kodeine
June 12th, 2012, 08:05 PM
Saluton!

So I'm trying to check if a process is running and while it is keep doing something. I'm trying to use the 'pidof' command which returns the PID of a given process name. If there is no process of the name given then it returns nothing. Here's what I've got so far.


while [[ $(pidof rhythmbox) != false ]]; do echo foorbar; sleep 3; done

However it doesn't work. Anyone know why?

Vaphell
June 12th, 2012, 08:15 PM
drop != false
[ $(pidof ...) ] should be enough

hakermania
June 12th, 2012, 08:19 PM
drop != false
[ $(pidof ...) ] should be enough
Isn't


while pidof X > /dev/null 2>&1; do ...

correct?

Kodeine
June 12th, 2012, 08:52 PM
drop != false
[ $(pidof ...) ] should be enough

Ah yes that works.