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@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

Ever hear of pgrep(1)?

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

Attachment: pgpzsxgMvlyzm.pgp
Description: PGP signature

Reply via email to