Mail Archives: cygwin/2003/02/04/18:09:38
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/
- Raw text -