Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
X-Authentication-Warning: aberdeen.fpcc.net: laubster set sender to cygwin@laubster.org using -f
Date: Tue, 4 Feb 2003 16:15:05 -0700
From: "J.D. Laub" <cygwin@laubster.org>
To: cygwin@cygwin.com
Subject: Re: extraneous 'I' in ps output (RESOLUTION)
Message-ID: <20030204231505.GA5625@aberdeen.fpcc.net>
References: <20030204154222.GA3915@aberdeen.fpcc.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20030204154222.GA3915@aberdeen.fpcc.net>
User-Agent: Mutt/1.4i
Organization: The Psychiatric Ward of Terrors

On Tue, Feb 04, 2003 at 08:42:22AM -0700, J.D. Laub wrote:
>       PID    PPID    PGID     WINPID  TTY  UID    STIME COMMAND
> I    1268       1    1268       1268  con 12917 07:42:04 /usr/bin/bash
> Anytime ps is called from command substitution, an 'I' gets
> prepended to the line for the top shell.

Thanks to Andrew for the pointer to the source, and to Ronald and
Christopher for their insight.

Inspection of the code shows ps is working as designed.  There's an
undocumented column in the default ps output which indicates status.
The column has no header, and it may not always be populated.  The
column can be suppressed by using either -f or the non-standard -s.

To find out what shell is currently running, I've changed my
.profile (which handles any of sh/zsh/bash/bash2/ksh on a half dozen
operating systems) from this:

    shell=`ps | awk "{if ($$ == \\$1) print \\$NF}" \
        | sed -e 's,.*/,,' -e 's,-,,'`

to this:

    shell=`ps | sed 's/^[^0-9 ]*//' \
        | awk "{if ($$ == \\$1) print \\$NF}" \
        | sed -e 's,.*/,,' -e 's,-,,'`
-- 
J.D. Laub (Laubster) |"Your leg's too long / Your skull's too strong /
cygwin@laubster.org  | Suppose your nose is wrong." - Renaldo & the Loaf

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

