Re: |& in bash?

2013-01-22 Thread Steven W. Orr
On 1/21/2013 1:20 PM, John Caruso wrote: In article , Dan Douglas wrote: It isn't very common to dump multiple streams into one pipe. echo "n't very" >/dev/null 2>&1 I suggest avoiding |&. Personally I wouldn't use it in scripts, since I try to stick as close to plain vanilla Bourne shell

Re: |& in bash?

2013-01-22 Thread Greg Wooledge
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 pe

Re: |& in bash?

2013-01-22 Thread Bob Proulx
Greg Wooledge wrote: > On Tue, Jan 22, 2013 at 06:56:31AM -0500, Steven W. Orr wrote: > > By that logic, > > [...alternate possibility omitted...] > > So, in chronological order: > [...list of actions omitted...] I think the take-away here is that the shell evolved to require 142 unique command l

Re: |& in bash?

2013-01-22 Thread Andreas Schwab
Greg Wooledge 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 fir

Re: |& in bash?

2013-01-22 Thread DJ Mills
On Tue, Jan 22, 2013 at 1:45 PM, Andreas Schwab wrote: > 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). > > And that's the issue, a pipe is *not*

Re: |& in bash?

2013-01-22 Thread Greg Wooledge
On Tue, Jan 22, 2013 at 07:45:10PM +0100, Andreas Schwab wrote: > Greg Wooledge writes: > > On Tue, Jan 22, 2013 at 06:56:31AM -0500, Steven W. Orr wrote: > >> foo 2>&1 | bar > > The pipeline is created first, and *then* the dup (2>&1) is > > performed. > This is true, but not obviously so. If yo

Re: |& in bash?

2013-01-22 Thread Bob Proulx
Greg Wooledge wrote: > It kinda reminds me of the Linux newcomers who don't know how to do > gzip -dc foo.tar.gz | tar xvf - (and so on) because they've been trained > to use GNU tar's "z" flag instead, and therefore that piece of their > education hasn't been absorbed yet. Just like: grep -r P