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

[PATCH][DOC] Re: Redirection bug for stderr?



2014-11-20 16:58:59 +0000, Stephane Chazelas:
[...]
> Or:
>
> % { print output; print error >&2 } 2>&1 >&- >foo.out | sed 's/error/erratic/'
[...]

Here as a patch. Also adding a missing "hideval" in ${(t)var}
description (unrelated).


diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo
index a0478e7..f1334e3 100644
--- a/Doc/Zsh/expn.yo
+++ b/Doc/Zsh/expn.yo
@@ -1061,6 +1061,9 @@ for arrays which keep only the first occurrence of duplicated values
 item(tt(hide))(
 for parameters with the `hide' flag
 )
+item(tt(hideval))(
+for parameters with the `hideval' flag
+)
 item(tt(special))(
 for special parameters defined by the shell
 )
diff --git a/Etc/FAQ.yo b/Etc/FAQ.yo
index 7d4b86e..eaffe71 100644
--- a/Etc/FAQ.yo
+++ b/Etc/FAQ.yo
@@ -1784,7 +1784,14 @@ sect(Why is my output duplicated with `tt(foo 2>&1 >foo.out | bar)'?)
   to both files when the redirector appears twice.  What's going on in the
   first example is exactly the same, however the second redirector is
   disguised as a pipe.  So if you want to turn this effect off, you need
-  to unset the option mytt(MULTIOS).
+  to unset the option mytt(MULTIOS) or write it:
+  verb(
+    % { print output; print error >&2 } 2>&1 >&- >foo.out | sed 's/error/erratic/'
+    erratic
+  )
+  By closing stdout with tt(>&-), we're cancelling the previous redirections
+  (to the pipe) and start anew with tt(>foo.out) instead of adding it as a
+  redirection target to stdout.
 
 
 sect(What are these `^' and `~' pattern characters, anyway?)



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