Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Jan 2011 16:43:37 +0100
From:      =?ISO-8859-1?Q?Samuel_Mart=EDn_Moro?= <faust64@gmail.com>
To:        Chad Kellerman <sunckell@gmail.com>
Cc:        Frank Bonnet <f.bonnet@esiee.fr>, freebsd-questions@freebsd.org
Subject:   Re: problem with shell script
Message-ID:  <AANLkTinkSOUm84RamXn8qToxb5YQG%2BH6VwOtKZJVy7nN@mail.gmail.com>
In-Reply-To: <AANLkTikcH9jjNNf-1vwTzgxekH5bp%2BdXnnvh923f1NcM@mail.gmail.com>
References:  <4D2DB449.6070901@esiee.fr> <AANLkTimHU7kQXM0agHsfz=hHn2zuBuL4xihDxUWo3%2BvB@mail.gmail.com> <AANLkTikcH9jjNNf-1vwTzgxekH5bp%2BdXnnvh923f1NcM@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jan 12, 2011 at 4:34 PM, Samuel Mart=EDn Moro <faust64@gmail.com>wr=
ote:

>
>
> On Wed, Jan 12, 2011 at 3:50 PM, Chad Kellerman <sunckell@gmail.com>wrote=
:
>
>> On Wed, Jan 12, 2011 at 9:01 AM, Frank Bonnet <f.bonnet@esiee.fr> 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=3D0
>> > SD=3D`ps -ax | grep slapd | grep -v grep | wc -l`
>> > echo $SD
>> >
>> > the result is 3 !!!
>> >
>>
> ps ax | grep "[/]slapd " | wc -l
>
ps ax | awk '/[/]slapd /{n++} END{print n}'
sorry...

> may not fix the problem
> but still cleaner
>
>>  >
>> > Any info welcome !
>> >
>>
>> What's the name of your script?  Hope it's not slapd_check.sh that will
>> cause and extra count in the ps, cus it will count itself.
>>
>>
>> Chad
>>
>> >
>> > _______________________________________________
>> > 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"
>> >
>>
>>
>>
>> --
>> A grasshopper walks into a bar and the bartender says "Hey, we have a
>> drink
>> named after you." And the grasshopper says "Really, You have a drink nam=
ed
>> Murray?"
>> _______________________________________________
>> 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"
>>
>
>
>
> --
> Samuel Mart=EDn Moro
> {EPITECH.} 2011
> CamTrace S.A.S
>
> "Nobody wants to say how this works.
>  Maybe nobody knows ..."
>                       Xorg.conf(5)
>



--=20
Samuel Mart=EDn Moro
{EPITECH.} 2011
CamTrace S.A.S

"Nobody wants to say how this works.
 Maybe nobody knows ..."
                      Xorg.conf(5)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTinkSOUm84RamXn8qToxb5YQG%2BH6VwOtKZJVy7nN>