* pipelines transmitting data even after redirecting stdout
@ 2019-05-31 3:35 Kartik Agaram
2019-05-31 4:33 ` Philippe Troin
0 siblings, 1 reply; 2+ messages in thread
From: Kartik Agaram @ 2019-05-31 3:35 UTC (permalink / raw)
To: zsh-workers
In the rest of this message I'm running within a zsh sub-process
without any dotfiles or inherited environment variables:
env -i zsh -f
This command works as expected:
% echo abc > /dev/null
% # no output
However, adding another pipestage to it is unexpected:
% echo abc > /dev/null |cat
abc # whoa!
If I redirect stdout to a file I seem to get some `tee`-like behavior for free:
% echo abc >x |cat
abc
% cat x
abc
Is this somehow expected behavior? I've tested it on the following
systems and gotten identical results:
1. zsh 5.7.1 (x86_64-apple-darwin18.2.0) on Mac OS 10.14.5
2. zsh 5.4.2 on Ubuntu 18.04
(Please explicitly include my email address in responses.)
Thank you,
Kartik
http://akkartik.name/about
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: pipelines transmitting data even after redirecting stdout
2019-05-31 3:35 pipelines transmitting data even after redirecting stdout Kartik Agaram
@ 2019-05-31 4:33 ` Philippe Troin
0 siblings, 0 replies; 2+ messages in thread
From: Philippe Troin @ 2019-05-31 4:33 UTC (permalink / raw)
To: Kartik Agaram, zsh-workers
On Thu, 2019-05-30 at 20:35 -0700, Kartik Agaram wrote:
> This command works as expected:
>
> % echo abc > /dev/null
> % # no output
>
> However, adding another pipestage to it is unexpected:
>
> % echo abc > /dev/null |cat
> abc # whoa!
>
> If I redirect stdout to a file I seem to get some `tee`-like behavior for free:
>
> % echo abc >x |cat
> abc
> % cat x
> abc
>
> Is this somehow expected behavior?
Yes, it's a feature called multios, check the zsh manpage MULTIOS
section for details or
http://zsh.sourceforge.net/Doc/Release/Redirection.html#Multios
Phil.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-05-31 4:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-31 3:35 pipelines transmitting data even after redirecting stdout Kartik Agaram
2019-05-31 4:33 ` Philippe Troin
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).