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

Re: Learning Scripting



On Mon, May 15, 2006 at 11:18:11PM +0530, Anil Gupte wrote:
> 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)
----------^

I'm sure that's not right.

> 
> if [ count>0 ]
------^ you need a $ here and I found this works:



if [ $count -gt 0 ]


A


>  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 
> 
> 
> -- 
> To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org 
> with a subject of "unsubscribe". Trouble? Contact 
> listmaster@lists.debian.org
> 

Attachment: signature.asc
Description: Digital signature


Reply to: