[OT] What does this pipe do? (fwd)

Dan Nelson dnelson at allantgroup.com
Wed Jan 24 03:06:14 UTC 2007


In the last episode (Jan 23), youshi10 at u.washington.edu said:
> On Tue, 23 Jan 2007, Robert Huff wrote:
> >youshi10 at u.washington.edu writes:
> >> I know this is a Unix shell command, and off-topic, but I'm
> >> curious. I've been reading a few 'make' commands at work that end
> >> in "|&" and I was wondering if that redirection string is
> >> synonymous to "| /dev/stdout".
> >
> > That's (t)csh-speak for "send both stdout and stderr to the pipe". 
> > '|' only covers stdout.
> 
> No similar shortened command for bash/sh, other than &1>/dev/stdout
> &2>/dev/stdout?

"2>&1 |" is the sh equivalent.  Here's a snippet from the from the zsh
manpage:

 A  pipeline  is  either  a simple command, or a sequence of two or more
 simple commands where each command is separated from the next by `|' or
 `|&'.   Where commands are separated by `|', the standard output of the
 first command is connected to the standard input of the next.  `|&'  is
 shorthand for `2>&1 |', which connects both the standard output and the
 standard error of the command to the standard input of the  next. 

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-questions mailing list