problem with shell script
Chip Camden
sterling at camdensoftware.com
Wed Jan 12 16:32:08 UTC 2011
Quoth Frank Bonnet on Wednesday, 12 January 2011:
> 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"
Ever hear of pgrep(1)?
--
Sterling (Chip) Camden | sterling at camdensoftware.com | 2048D/3A978E4F
http://camdensoftware.com | http://chipsquips.com | http://chipstips.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20110112/b8217678/attachment.pgp
More information about the freebsd-questions
mailing list