shell script question

David daz at undertaker.homeip.net
Mon Jul 31 14:36:30 MST 2006


What is the point of the below in a script?  This snippage is in the 
'stop' portion of an init script.  I just dont see the point of the if 
statement. It almost looks like it's just making sure $pid isn't empty.


------begin snippet------

pid=`/bin/ps -e | grep process_name | grep -v mon | grep -v grep | 
sed -e 's/^  *//' -e 's/ .*//' | head -1`
     if [ "X$pid" != "X" ]
     then
             /bin/kill $pid
             echo "**process_name** interface stopped"
     fi
------end snippet------

Thanks,
David

-- 
"I find your lack of faith disturbing."
--Darth Vader
---
  14:32:01 up 9 days, 47 min,  1 user,  load average: 0.00, 0.00, 0.00


More information about the PLUG-discuss mailing list