On Thu, Oct 12, 2000 at 09:23:29AM +0930, Brian Salter-Duke 
<[EMAIL PROTECTED]> wrote:
> > 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.

    I've been working a lot with ps in Tru64 UNIX and reading the Unix98
(Single Unix Spec V2) standards, and this is undefined behaviour.
Basically, ps takes a snapshot of the processes running at an instant in
time.  Depending on how it does this, and how the system manages
processes, the ps command itself may or may not show.  Some Unices will
even show it sometimes and not others.

-- 
Bob Bell <[EMAIL PROTECTED]>
-------------------------------------------------------------------------
 "The sooner you start to code, the longer the program will take."
   -- Roy Carlson, University of Wisconsin

Reply via email to