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

Re: Bug report + feature request



>    ls -l /tmp/z   3>&1 1>&2 2>&3 | while read line ;do echo ":: "$line; done
>    
>    total 16
>    -rw-r--r--   1 sbeck    apps         396 Oct  5 13:44 foo
>    :: total 16
>    :: -rw-r--r--   1 sbeck    apps         396 Oct  5 13:44 foo
> 
> Notice that in the 3rd section, the output from the command ends up on
> both STDOUT and STDERR.  All other shells (ksh, sh, bash) that I tested
> give the correct output for the 3rd case:
> 
>    total 16
>    -rw-r--r--   1 sbeck    apps         396 Oct  5 13:44 foo

That's not a bug, it's due to zsh's `multios' feature, where a repeated
mention of an fd means that it should be used twice:  on input this does
cat, and on output it does tee.  In this case fd 1 is used for copying to 2
and as a pipe, so stdout goes to both.  You need to `setopt nomultios' to
turn this off.

It's about time we had a `no_pipe_multios' option --- this gets so many
people (including me, before now).

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070



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