This is the mail archive of the
cygwin-developers@cygwin.com
mailing list for the Cygwin project.
Re: bash misbehavior
On Tue, Sep 28, 2004 at 11:35:17PM -0400, Pierre A. Humblet wrote:
>At 11:19 PM 9/28/2004 -0400, Christopher Faylor wrote:
>>On Tue, Sep 28, 2004 at 11:08:56PM -0400, Pierre A. Humblet wrote:
>>>Yep, that would work too, but it's costly. In bash there is a new
>>>process group leader for every command/pipeline
>>>I will leave this issue simmer for a while.
>>
>>But does the process group leader always go away? I would think that
>>would be a pretty odd case.
>
>Unfortunately yes, they only last for the duration of a command/pipeline.
>The process group is used as a command/pipeline/job identifier.
>A lonely ps is a group leader:
>~: ps
> PID PPID PGID WINPID TTY UID STIME COMMAND
> 631139 1 631139 4294336157 con 740 22:56:00 /c/PROGRAM FILES/CYGWIN/BIN/RXVT
> 607931 631139 607931 4294382649 0 740 22:56:00 /c/PROGRAM FILES/CYGWIN/BIN/BASH
> 620183 607931 620183 4294347869 0 740 23:33:11 /usr/bin/ps
That doesn't really show anything since every program has a pgid which
is associated with a running pid.
This command would show an occurrence of a pgid that has no associated
pid.
echo hello | (sleep 20; cat)&
On linux you can see the effect, like this:
bash-2.05b$ echo hello | (sleep 20; cat)&
[1] 7192
bash-2.05b$ ps -o '%p%u%r%y%a'
or http://procps.sf.net/faq.html
PID RUSER PGID TTY COMMAND
25248 cgf 25248 pts/45 -zsh
6863 cgf 6863 pts/45 bash
7192 cgf >>7191 pts/45 bash
7193 cgf >>7191 pts/45 sleep 20
I guess the left side of a pipe exiting before the right is the norm.
cgf