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

Re: pipelines transmitting data even after redirecting stdout



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.



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