zsh-workers
 help / color / mirror / code / Atom feed
From: Borzenkov Andrey <Andrej.Borsenkow@mow.siemens.ru>
To: "'Matthias Scheler'" <tron@zhadum.de>, zsh-workers@sunsite.dk
Subject: RE: I/O redirection problem in "zsh"
Date: Fri, 25 Oct 2002 15:16:13 +0400	[thread overview]
Message-ID: <6134254DE87BD411908B00A0C99B044F03A0B4B6@MOWD019A> (raw)
In-Reply-To: <20021025104047.GA27855@colwyn.zhadum.de>


> 
> 	Hello,
> 
> the I/O redirection in the following command doesn't work properly in
> "zsh":
> 
> grep localhost /etc/hosts fasel 2>&1 >/dev/null | cat -b
> 
> tron@colwyn:~>grep localhost /etc/hosts fasel 2>&1 >/dev/null | cat -b
>      1  grep: fasel: No such file or directory
>      2  /etc/hosts:::1                                  localhost
>      3  /etc/hosts:127.0.0.1                            localhost
> tron@colwyn:~>sh
> $ grep localhost /etc/hosts fasel 2>&1 >/dev/null | cat -b
>      1  grep: fasel: No such file or directory
> $ bash
> bash-2.05$ grep localhost /etc/hosts fasel 2>&1 >/dev/null | cat -b
>      1  grep: fasel: No such file or directory
> bash-2.05$ ksh
> $ grep localhost /etc/hosts fasel 2>&1 >/dev/null | cat -b
>      1  grep: fasel: No such file or directory
> 
> I can reproduce this problem with ZSH 3.0.8 under Solaris and ZSH
4.0.6
> under NetBSD.
> 

This ambiguous. Both > and | mean redirection of stdout. Now, Zsh first
does redirections and then applies pipeline (which effectively reopens
stdout) and other shells first apply pipeline and then (inside of simple
command) do redirections. The following from SUS  makes me believe Zsh
is more correct:

"The standard output of command1 shall be connected to the standard
input of command2. The standard input, standard output, or both of a
command shall be considered to be assigned by the pipeline before any
redirection specified by redirection operators that are part of the
command (see Redirection )."

What other shells effectively do is to pipeline stderr not stdout.
Still I do not fully understand this sentence so I am not sure if my
interpretation is correct.

-andrey


  parent reply	other threads:[~2002-10-25 11:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-25 10:40 Matthias Scheler
2002-10-25 11:13 ` Oliver Kiddle
2002-10-25 11:16 ` Borzenkov Andrey [this message]
2002-10-25 11:44   ` Matthias Scheler
2002-10-25 12:15     ` Oliver Kiddle
2002-11-06 10:10     ` Zefram

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6134254DE87BD411908B00A0C99B044F03A0B4B6@MOWD019A \
    --to=andrej.borsenkow@mow.siemens.ru \
    --cc=tron@zhadum.de \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).