problem with shell script

Frank Bonnet f.bonnet at esiee.fr
Wed Jan 12 14:16:59 UTC 2011


Hello

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
       1

If I run in the following shell script :

#!/bin/sh
SD=0
SD=`ps -ax | grep slapd | grep -v grep | wc -l`
echo $SD

the result is 3 !!!


Any info welcome !



More information about the freebsd-questions mailing list