[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] stdout and stderr to two different process substitutions
From: |
Greg Wooledge |
Subject: |
Re: [Help-bash] stdout and stderr to two different process substitutions |
Date: |
Wed, 25 Jan 2012 15:02:07 -0500 |
User-agent: |
Mutt/1.4.2.3i |
On Wed, Jan 25, 2012 at 01:51:39PM -0600, Peng Yu wrote:
> OK. I see my mistake. But I still don't understand why stdout of tee
> goes to stdout of foo, hence redirected to the stdin of gzip hence
> goes to xx.gz. This appears to be that tee and foo share the same
> stdout.
>
> foo > >(gzip >xx.gz) 2> >(tee yy)
Step 1: gzip is run in the background. Its input is connected to a pipe "A".
Step 2: FOO'S STDOUT IS REDIRECTED TO PIPE A.
Step 3: tee is run in the background. 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.
Step 4: other stuff
Yes, "tee and foo share the same stdout" *because this is the broken
version* and is missing the redirection of tee's stdout.
In the fixed version, tee's stdout is redirected, and in that case,
tee and foo no longer share the same stdout.
If you spend all your time analyzing broken code, you're just going to
drive yourself insane. You're already starting to get to me.
Wouldn't it be better to spend your time on working code instead?
- Re: [Help-bash] stdout and stderr to two different process substitutions, (continued)
- Re: [Help-bash] stdout and stderr to two different process substitutions, Peng Yu, 2012/01/25
- Re: [Help-bash] stdout and stderr to two different process substitutions, Greg Wooledge, 2012/01/25
- Re: [Help-bash] stdout and stderr to two different process substitutions, Peng Yu, 2012/01/25
- Re: [Help-bash] stdout and stderr to two different process substitutions, Greg Wooledge, 2012/01/25
- Re: [Help-bash] stdout and stderr to two different process substitutions, Peng Yu, 2012/01/25
- Re: [Help-bash] stdout and stderr to two different process substitutions, Peng Yu, 2012/01/25
- Re: [Help-bash] stdout and stderr to two different process substitutions, Greg Wooledge, 2012/01/25
- Re: [Help-bash] stdout and stderr to two different process substitutions, Peng Yu, 2012/01/25
- Re: [Help-bash] stdout and stderr to two different process substitutions, Greg Wooledge, 2012/01/25
- Re: [Help-bash] stdout and stderr to two different process substitutions, Peng Yu, 2012/01/25
- Re: [Help-bash] stdout and stderr to two different process substitutions,
Greg Wooledge <=
- Re: [Help-bash] stdout and stderr to two different process substitutions, Chet Ramey, 2012/01/25
- Re: [Help-bash] stdout and stderr to two different process substitutions, Bob Proulx, 2012/01/25
- Re: [Help-bash] stdout and stderr to two different process substitutions, Greg Wooledge, 2012/01/25
- Re: [Help-bash] stdout and stderr to two different process substitutions, Bob Proulx, 2012/01/25
- Re: [Help-bash] stdout and stderr to two different process substitutions, Peng Yu, 2012/01/25
- Re: [Help-bash] stdout and stderr to two different process substitutions, Chet Ramey, 2012/01/25