I\'m writing a script (show_volume.sh) which may be called several times in short intervals. I need a way to determine whether there is more than just one running instance o
At the moment ps
runs a process grep show_volume.sh
is also running, so you always count the grep!
Simple solution, grep s[h]ow_volume.sh
. The grep (not shell) will collapse the [h]
to h
and search for what you want, but your grep won't match itself because it will have [] in the parameter.
pgrep
is also useful for this task and is smart enough to always exclude itself.