Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

STDOUT on STDERR redirected/duplicated?



Hi all,

Please study these outputs:
-----
zsh-4.0.7$ echo "abc"    
abc
zsh-4.0.7$ echo "abc" | xargs echo
abc
zsh-4.0.7$ echo "abc" 1>&2       
abc
zsh-4.0.7$ echo "abc" 1>&2 | xargs echo
abc
abc
bash-2.05b$ echo "abc"
abc
bash-2.05b$ echo "abc" | xargs echo
abc
bash-2.05b$ echo "abc" 1>&2
abc
bash-2.05b$ echo "abc" 1>&2 | xargs echo
abc

-----
Yes, the last line is a blank line.

My understanding of the difference between Zsh and Bash when "1>&2" is performed is that STDOUT becomes valid (duplicated from STDERR) for the pipe "|" [for Zsh], whereas STDOUT is gone (redirected to STDERR) for the pipe "|" [for Bash]. Is this correct? Could someone offer an explanation of the Zsh internals.

For a sanity check, the pipe "|" means redirect STDOUT of left-side operation to STDIN of right-side operation. Correct? :)

Thanks.
--
Gerald Lai


Messages sorted by: Reverse Date, Date, Thread, Author