bug-bash
[Top][All Lists]
Advanced

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

Re: |& in bash?


From: Andreas Schwab
Subject: Re: |& in bash?
Date: Tue, 22 Jan 2013 19:45:10 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.92 (gnu/linux)

Greg Wooledge <wooledg@eeg.ccf.org> writes:

> On Tue, Jan 22, 2013 at 06:56:31AM -0500, Steven W. Orr wrote:
>> By that logic,
>> 
>> foo 2>&1 | bar
>> 
>> should not work, but it does. It takes stderr and dups it to stdout, and 
>> *then* takes stdout and send it to a pipe.
>
> Incorrect.  The pipeline is created first, and *then* the dup (2>&1) is
> performed.

This is true, but not obviously so.  If you have the rule "redirections
are processed from left to right", then this looks like an outlier (if
you treat the pipe as another kind of redirection).

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



reply via email to

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