grep & egrep script problem

Tim Fenn fenn at stanford.edu
Thu Nov 2 10:29:48 UTC 2006


On Thu, Nov 02, 2006 at 08:45:45AM +0000, Paul Ward wrote:
> 
> I am wanting to find multiple proccess and then produce a true exit
> code if they are all there and a false if they are not.
> 
> I have been looking into this but can find no easy way of doing this.
> 

[ -n "$(pidof test1)" ] && [ -n "$(pidof test2)" ] && exit 0 || exit 1

or, if you had a list of pids:

for i in $pid ; do [ -n "$(pidof $i)" ] || exit 1 ; done

HTH,
Tim

-- 
Morals?  I eat communism and $h!t America, brother.  --Seanbaby




More information about the users mailing list