Re: Learning Scripting
Am 2006-05-15 23:18:11, schrieb Anil Gupte:
> BlankHi all:
>
> what am I doing worng here? Here is my script:
> **********************
> #!/bin/sh
>
> msgtest="jumbalaya"
>
> test1=$(ps ax)
>
> echo $test1>psout.temp
>
> check=$(grep -i $msgtest psout.temp)
> count=$(#check)
>
> if [ count>0 ]
> then
> echo "Found it!"
> # shutdown -r now
> else
> echo "Not found!"
> fi
> ***********************
Why not:
---8<-----------------------------------
#!/bin/sh
msgtest="jumbalaya"
ps ax |grep -i $msgtest >/dev/null 2>&1
if [ $? -eq 0 ] ; then
echo "Found it!"
shutdown -r now
else
echo "Not found!"
fi
---8<-----------------------------------
Greetings
Michelle Konzack
Systemadministrator
--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
Michelle Konzack Apt. 917 ICQ #328449886
50, rue de Soultz MSM LinuxMichi
0033/6/61925193 67100 Strasbourg/France IRC #Debian (irc.icq.com)
Reply to: