Package: bash
Version: 4.1-3
Severity: normal

*** Please type your report below this line ***

The manpage says:

"[1] If |& is used, the standard error of command is connected to
command2's standard input through the pipe; [2] it is shorthand for
2>&1 |.  This implicit  redirection of the standard error is
performed after any redirections specified by the command."

At first glance, [1] and [2] say the same, but that's not so, as
this example shows:

% sh -c 'echo stdout; echo stderr >&2' > /dev/null |& cat

Here, both stdout and stderr are redirected to /dev/null. That's
what [2] says, but not what [1] says.

So at the very least this is a documentation bug, and the manpage
should say:

"If |& is used, the standard error of command is connected to
whatever the standard output is connected to which may or may not be
the pipe to command2's standard input;"

However, I wonder if the behaviour is really very meaningful. Since
the "|&" token refers to the pipe syntactically, one would naively
expect that its behaviour has to do with the pipe. Of course, it's
easy to work-around by wrapping the command in a subshell which does
what I'd have expected:

% (sh -c 'echo stdout; echo stderr >&2' > /dev/null) |& cat
stderr

-- System Information:
Debian Release: 6.0.2
  APT prefers stable
  APT policy: (990, 'stable'), (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 3.2.2 (SMP w/6 CPU cores)
Locale: LANG=de_DE, LC_CTYPE=de_DE (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/dash

Versions of packages bash depends on:
ii  base-files                6.0squeeze2    Debian base system miscellaneous f
ii  dash                      0.5.5.1-7.4    POSIX-compliant shell
ii  debianutils               3.4            Miscellaneous utilities specific t
ii  libc6                     2.13-10        Embedded GNU C Library: Shared lib
ii  libncurses5               5.7+20100313-5 shared libraries for terminal hand

Versions of packages bash recommends:
ii  bash-completion               1:1.2-3    programmable completion for the ba

Versions of packages bash suggests:
pn  bash-doc                      <none>     (no description available)

-- no debconf information


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to