problem with shell script

Julien Cigar jcigar at ulb.ac.be
Thu Jan 13 13:12:25 UTC 2011


just use: pgrep "slapd"

On 01/12/2011 15:17, four.harrisons at googlemail.com wrote:
> 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 !
>
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
>
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"


-- 
No trees were killed in the creation of this message.
However, many electrons were terribly inconvenienced.


More information about the freebsd-questions mailing list