shell script question

JD Austin jd at twingeckos.com
Mon Jul 31 14:40:43 MST 2006


David wrote:
>
> 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
>

It's preventing it from killing a process that isn't running 
/usr/bin/kill by itself will error.

-- 
JD Austin
Twin Geckos Technology Services LLC
email: jd at twingeckos.com
http://www.twingeckos.com
phone/fax: 480.288.8195 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.plug.phoenix.az.us/pipermail/plug-discuss/attachments/20060731/7cc42ce4/attachment.htm


More information about the PLUG-discuss mailing list