zsh-workers
 help / color / mirror / code / Atom feed
* Different behaviour of zsh with two input redirections compared to all other POSIX shells I have installed
@ 2014-12-15 11:33 Axel Beckert
  2014-12-15 11:46 ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Axel Beckert @ 2014-12-15 11:33 UTC (permalink / raw)
  To: zsh-workers

Hi,

while I was debugging some non-zsh related issue with "yes '' |
sometool", I noticed that zsh behaves differently in the following
(possibly neither common nor useful, likely esoteric :-) case:

~ → cat /tmp/bar.txt
bar
~ → zsh -c 'echo foo | cat -v < /tmp/bar.txt'
foo
bar
~ → bash -c 'echo foo | cat -v < /tmp/bar.txt'
bar
~ → dash -c 'echo foo | cat -v < /tmp/bar.txt'
bar
~ → ksh -c 'echo foo | cat -v < /tmp/bar.txt'
bar
~ → mksh -c 'echo foo | cat -v < /tmp/bar.txt'
bar

Interestingly some non-POSIX shells have the probably sanest approach:

~ → tcsh -c 'echo foo | cat -v < /tmp/bar.txt'
Ambiguous input redirect.
~ → csh -c 'echo foo | cat -v < /tmp/bar.txt'
Ambiguous input redirect.

(And yes, csh is _not_ a symlink to tcsh on that system. :-)

Is this expected/wanted zsh behaviour? Is this something we should fix
in zsh? And if so, should it rather behave like bash or like tcsh? :-)

I tend to tcsh's variant although I suspect that this could cause more
breakage than bash's behaviour.

		Kind regards, Axel
-- 
/~\  Plain Text Ribbon Campaign                   | Axel Beckert
\ /  Say No to HTML in E-Mail and News            | abe@deuxchevaux.org  (Mail)
 X   See http://www.nonhtmlmail.org/campaign.html | abe@noone.org (Mail+Jabber)
/ \  I love long mails: http://email.is-not-s.ms/ | http://noone.org/abe/ (Web)


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Different behaviour of zsh with two input redirections compared to all other POSIX shells I have installed
  2014-12-15 11:33 Different behaviour of zsh with two input redirections compared to all other POSIX shells I have installed Axel Beckert
@ 2014-12-15 11:46 ` Peter Stephenson
  2014-12-15 11:53   ` Axel Beckert
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2014-12-15 11:46 UTC (permalink / raw)
  To: zsh-workers

On Mon, 15 Dec 2014 12:33:14 +0100
Axel Beckert <abe@deuxchevaux.org> wrote:
> Is this expected/wanted zsh behaviour? Is this something we should fix
> in zsh? And if so, should it rather behave like bash or like tcsh? :-)

You'll need to try with "unsetopt multios" before comparing with other
shells.  (I'm not suggesting that necessarily removes all issues...)

pws


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Different behaviour of zsh with two input redirections compared to all other POSIX shells I have installed
  2014-12-15 11:46 ` Peter Stephenson
@ 2014-12-15 11:53   ` Axel Beckert
  0 siblings, 0 replies; 3+ messages in thread
From: Axel Beckert @ 2014-12-15 11:53 UTC (permalink / raw)
  To: zsh-workers

Hi Peter,

On Mon, Dec 15, 2014 at 11:46:57AM +0000, Peter Stephenson wrote:
> On Mon, 15 Dec 2014 12:33:14 +0100
> Axel Beckert <abe@deuxchevaux.org> wrote:
> > Is this expected/wanted zsh behaviour? Is this something we should fix
> > in zsh? And if so, should it rather behave like bash or like tcsh? :-)
> 
> You'll need to try with "unsetopt multios" before comparing with other
> shells.  (I'm not suggesting that necessarily removes all issues...)

Thanks for that hint. I knew about multiple output redirection being a
zsh-only feature, but I didn't expect that this also affects input
redirection in the same way despite it makes sense (now).

And indeed:

~ → zsh -o nomultios -c 'echo foo | cat -v < /tmp/bar.txt'
bar

So it's not a bug, it's a feature! Thanks again. :-)

		Kind regards, Axel
-- 
/~\  Plain Text Ribbon Campaign                   | Axel Beckert
\ /  Say No to HTML in E-Mail and News            | abe@deuxchevaux.org  (Mail)
 X   See http://www.nonhtmlmail.org/campaign.html | abe@noone.org (Mail+Jabber)
/ \  I love long mails: http://email.is-not-s.ms/ | http://noone.org/abe/ (Web)


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-12-15 11:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-15 11:33 Different behaviour of zsh with two input redirections compared to all other POSIX shells I have installed Axel Beckert
2014-12-15 11:46 ` Peter Stephenson
2014-12-15 11:53   ` Axel Beckert

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).