[Top][All Lists]

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

Re: |& in bash?

From: Greg Wooledge
Subject: Re: |& in bash?
Date: Tue, 22 Jan 2013 13:54:23 -0500
User-agent: Mutt/

On Tue, Jan 22, 2013 at 07:45:10PM +0100, Andreas Schwab wrote:
> Greg Wooledge <address@hidden> 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 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).

Well... that's the way the shell works.  It's one of the things you need
to understand if you're working with complex shell scripts.  Even if
the Bash |& extension is embraced by the community, you'll still need
to understand how foo 2>&1 | bar works if you're doing work in POSIX or
Bourne shells.

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.

reply via email to

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