Thanks for the suggestions.  I'm getting inconsistent results, 
though.  When I run the following, the most common result is 5 but once in 
a while there is a 2, 3, or 4.  I'm not sure what's going on.

cnt=0
while [ $cnt -lt 70 ] ; do
   echo -n `ps -ef | grep -v grep | grep $0 | wc -l`
   let cnt+=1
done
echo

I can test for the maximum value out of 20 tests and I'm sure it would get 
the job done.  But at this point I'm curious why this happens.  Any ideas?

Thanks.
Karl


At 04:08 PM 4/8/2001 -0600, you wrote:
>This works from command line...
>
>    # if [ `ps -efw | grep -v grep | grep rerf |wc -l` -eq 0 ] ; then
>echo 'yes' ; else echo 'no' ; fi
>
>In a shell script, make it more readable...
>if [ `ps -efw | grep -v grep | grep rerf |wc -l` -eq 0 ]
>then
>    echo 'yes'
>    # more statements here, etc.
>else
>    echo 'no'
>fi
>
>-----
>Also, analias command that I use *often* is
>     # alias psg
>     alias psg='ps -efw | grep -v grep | grep'
>
>This avoids seeing the 'grep' that is forked off by your request.
>
>Thanks...Dan


Reply via email to