Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Jan 2011 08:32:02 -0800
From:      Chip Camden <sterling@camdensoftware.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: problem with shell script
Message-ID:  <20110112163202.GC3068@libertas.local.camdensoftware.com>
In-Reply-To: <4D2DB449.6070901@esiee.fr>
References:  <4D2DB449.6070901@esiee.fr>

next in thread | previous in thread | raw e-mail | index | archive | help

--O3RTKUHj+75w1tg5
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Quoth Frank Bonnet on Wednesday, 12 January 2011:
> Hello
>=20
> I'm in trouble with a simple shell script that give
> erroneous value when running ...
>=20
> If I run commands interactively everything runs well
>=20
> > ps ax | grep slapd | grep -v grep | wc -l
>       1
>=20
> If I run in the following shell script :
>=20
> #!/bin/sh
> SD=3D0
> SD=3D`ps -ax | grep slapd | grep -v grep | wc -l`
> echo $SD
>=20
> the result is 3 !!!
>=20
>=20
> Any info welcome !
>=20
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.o=
rg"

Ever hear of pgrep(1)?

--=20
Sterling (Chip) Camden    | sterling@camdensoftware.com | 2048D/3A978E4F
http://camdensoftware.com | http://chipsquips.com       | http://chipstips.=
com

--O3RTKUHj+75w1tg5
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (FreeBSD)

iQEcBAEBAgAGBQJNLdeCAAoJEIpckszW26+R+bQH/iYef3ammlximoSigeYtNIyj
dNo3FZj3EmfW+tJq+oXLF9Bvo2rXv8VFevP0OoCP+MHsSQGF2l0ekM3+JjE2rcj6
Kx3YGtOPnPCGbD4JZgnjDtqPczZy2BTX1T0QSTNins2vaCS32fCzxdT+JOq14J/9
Hvg0OgWcRI0qrrRcr1inUZ59MbwipJq0gfQZGudz3ATdfB21I2yewBst5h4/wC+Q
ox8qBgPaBY8aLFtBgKJAsUwWcS4X3HhmYetyfH/4iH7wMkcUXPw/x73Ve0lN0IeO
+jmYy15LFlcYpKi21q/UQQYu/dFe9wF1oQP7UGsyD+1x1ci8PGLGt9u1PrvI5Gs=
=2fMX
-----END PGP SIGNATURE-----

--O3RTKUHj+75w1tg5--



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