Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Date: Wed, 27 Jul 2005 22:02:25 -0400 (EDT)
From: Igor Pechtchanski <pechtcha@cs.nyu.edu>
Reply-To: cygwin@cygwin.com
To: Don Beusee <dbeusee@yahoo.com>
cc: cygwin@cygwin.com
Subject: RE: ps -p <pid>
In-Reply-To: <20050728005142.97092.qmail@web31405.mail.mud.yahoo.com>
Message-ID: <Pine.GSO.4.61.0507272200250.27026@slinky.cs.nyu.edu>
References: <20050728005142.97092.qmail@web31405.mail.mud.yahoo.com>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII

Ugh, top-posting.  Reformatted.

On Wed, 27 Jul 2005, Don Beusee wrote:

> > -----Original Message-----
> > From: Carlo Florendo [mailto:list-subscriber@XX.XXXXX.XX]
> > Sent: Wednesday, July 27, 2005 5:22 PM
> > To: Don Beusee
> > Cc: cygwin@XXXXXX.XXX

<http://cygwin.com/acronyms/#PCYMTNQREAIYR>.  Thanks.

> > Don Beusee wrote:
> >
> > >Can you add the -p <pid> option?  All flavors of Unix these days
> > >allows you to specify which PID to ps.
> >
> > ps | grep <pid>
>
> That's not good enough for scripting.  First of all, the command is not
> so simple (you have to grep -v grep also - so that the same script works
> on Unix systems) and if you have small PID number like 14, that will
> likely return lots of other processes (like 114, etc).  Also, the same
> <PID> appears in the PPID column if it has children.  Some Unix variants
> might not have a space in the ps output between the PID and previous or
> next column when one of the column's data is larger than the specified
> printf format.
>
> So your command is not reliable enough for scripting and is also very
> slow on large Unix systems with 1000's of processes running.  ps -p
> <PID> is immediate, reliable, and portable (it's SYSV/SVR4 standard).

procps -p <PID>

HTH,
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

If there's any real truth it's that the entire multidimensional infinity
of the Universe is almost certainly being run by a bunch of maniacs. /DA

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

