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

Re: pipes and redirection



Gerald Skerbitz wrote:
> (print -u2 This is stderr;print This is stdout) 2>&1 1>test | less
> 
> which brought up less, with _both_ strings displayed.
> So, clearly, the | is picking up both streams.
> 
> Is there a way to cleanly do what I want it to do?

The correct answer, if you have a recent version of zsh, is
to `setopt nomultios' before trying the above.  Zsh's multio feature
is redirecting stdout both to test and to the pipe.  It's a little
counterintuitive here, as has been pointed out before.  The option
appeared some time mid 2.6beta.

-- 
Peter Stephenson <pws@xxxxxx>       Tel: +49 33762 77366
WWW:  http://www.ifh.de/~pws/       Fax: +49 33762 77413
Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.



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