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
That way grep won't be able to match itself.
--
Aaron Schrab [EMAIL PROTECTED] http://www.execpc.com/~aarons/
Besides, including <std_ice_cubes.h> is a fatal error on machines that
don't have it yet. Bad language design, there... :-) --Larry Wall