Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Jan 2011 14:12:22 +0100
From:      Julien Cigar <jcigar@ulb.ac.be>
To:        freebsd-questions@freebsd.org
Subject:   Re: problem with shell script
Message-ID:  <4D2EFA36.4020703@ulb.ac.be>
In-Reply-To: <4d2ef151.4310df0a.25b7.0199@mx.google.com>
References:  <4d2ef151.4310df0a.25b7.0199@mx.google.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------010101080308040104050206
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

just use: pgrep "slapd"

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


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

--------------010101080308040104050206--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4D2EFA36.4020703>