[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Learning Scripting



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
***********************

I always get the condition to be true no matter what I set msgtest to. Basically I am looking to see if I can find a specific string in ps ax and if so then I am going to reboot, otherwise not. I also tried

check=$(ps ax | grep -i $msgtest)

and this works on the cmmand line, but not in the script.

Any help would be appreciated.

Thanx,
Anil Gupte


Reply to: