help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] stdout and stderr to two different process substitutions


From: Chet Ramey
Subject: Re: [Help-bash] stdout and stderr to two different process substitutions
Date: Wed, 25 Jan 2012 15:34:45 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:8.0) Gecko/20111105 Thunderbird/8.0

On 1/25/12 3:02 PM, Greg Wooledge wrote:

> tee is a child process of foo, so
>         it inherits foo's FDs (stdin, stdout, stderr).  tee's stdout is
>       therefore inherited from foo.  However, back in step 2, foo's
>       stdout was sent to pipe A.  Therefore, when tee is launched in
>       the background, ITS STDOUT IS ALSO GOING TO PIPE A.

I think this is the key to understanding the construct.  Each process has
its own copy of its file descriptors, but it inherits its open file
descriptors from its parent.  That plus the fact that redirections are
processed left to right explains the inheritance.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]