> Date: Wed, 12 Jan 2011 15:01:45 +0100
> From: Frank Bonnet <f.bon...@esiee.fr>
> Subject: problem with shell script
>
> 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 !!!

Advice: don't try to 'out-think' the machine -- make it _show_ you what it
 is doing.

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.



_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

Reply via email to