On Mon, 31 Jul 2006, David wrote: > pid=`/bin/ps -e | grep process_name | grep -v mon | grep -v grep | sed > -e 's/^ *//' -e 's/ .*//' | head -1` There is a possibility that the return is empty (so the variable named "pid" does not have a value). > if [ "X$pid" != "X" ] So check here.