problem with shell script
bonomi at mail.r-bonomi.com
Thu Jan 13 20:39:49 UTC 2011
> Date: Wed, 12 Jan 2011 15:01:45 +0100
> From: Frank Bonnet <f.bonnet at esiee.fr>
> Subject: problem with shell script
> I'm in trouble with a simple shell script that give erroneous value when
> running ...
> If I run commands interactively everything runs well
> > ps ax | grep slapd | grep -v grep | wc -l
> If I run in the following shell script :
> SD=0 SD=`ps -ax | grep slapd | grep -v grep | wc -l` echo $SD
> the result is 3 !!!
Advice: don't try to 'out-think' the machine -- make it _show_ you what it
Change the script to:
SD=`ps -ax | grep slapd | grep -v grep | tee /dev/tty | wc -l` echo $SD
I suspect thet the -name- of the script file has 'slapd' in it.
More information about the freebsd-questions