Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-Authentication-Warning: aberdeen.fpcc.net: laubster set sender to cygwin AT laubster DOT org using -f Date: Tue, 4 Feb 2003 16:15:05 -0700 From: "J.D. Laub" To: cygwin AT cygwin DOT com Subject: Re: extraneous 'I' in ps output (RESOLUTION) Message-ID: <20030204231505.GA5625@aberdeen.fpcc.net> References: <20030204154222 DOT GA3915 AT aberdeen DOT fpcc DOT 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 AT laubster DOT 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/