Hi Aaron!

On Wed, 11 Oct 2000, Aaron Schrab wrote:

> At 09:23 +0930 12 Oct 2000, Brian Salter-Duke <[EMAIL PROTECTED]> wrote:
> > On Wed, Oct 11, 2000 at 04:38:31PM -0700, Bruce J.A. Nourish wrote:
> > > > if ps -U $LOGNAME | grep realmutt > /dev/null 
> > > 
> > > Be careful about using grep to search the output of ps. For example
> > > 
> > > $ ps ax | grep lemming
> > > 16004 tty1     S      0:00 grep lemming
> > > 
> > > Y'see? Grep makes a match on its own process.
> > 
> > It works OK on AIX 3.2.5 ps. If you add the -f flag it finds the grep
> > line, but it does'nt without it.
> > 
> > OK, so maybe my script does'nt work on all systems, but it is worth
> > playing with to see if some set of ps flags works as required.
> 
> Or you could just make a minor modification to the grep pattern:
> 
>   ps -U $LOGNAME | grep 'r[e]almutt' > /dev/null

I usually use   ps <some params> | grep <exe name> | grep -v grep ...

                                        yours,
                                        peter

-- 
PGP encrypted messages preferred.
http://www.cosy.sbg.ac.at/~ppalfrad/
[please CC me on lists]

PGP signature

Reply via email to