Ok, so tell me what foolish mistake I'm making here. Essentially, I'm trying to check if firefox is running before I continue with the script (I want it to NOT be running). My intent is to see if ps returns any lines when I look for a firefox process, and if I do, then abort the script. Otherwise, keep on going. The following is test snippet of my script to handle this check.
if [ `ps -ef | grep firefox | grep -v grep | wc -l` -eq 0 ]
echo "Cannot proceed: A firefox process is currently running."
The test does not seem to work, never detects if firefox is running. The code in backticks reports back the result I expect, but I can't seem to get the if test to behave. Any ideas?