about summary refs log tree commit diff
diff options
context:
space:
mode:
authorStephane Chazelas <stephane.chazelas@gmail.com>2014-11-23 18:27:41 +0000
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2014-11-23 18:29:09 +0000
commitff292af95f9bb6f07a56c162e583a145bbaa389d (patch)
tree0c52f30bf62a39eb76728f7a09fd383e81653606
parent02bca2ea0fe47611644bfc1ca8b93f215317c97d (diff)
downloadzsh-ff292af95f9bb6f07a56c162e583a145bbaa389d.tar.gz
zsh-ff292af95f9bb6f07a56c162e583a145bbaa389d.tar.xz
zsh-ff292af95f9bb6f07a56c162e583a145bbaa389d.zip
33740: FAQ: another way of avoiding MULTIOs effects on pipes
-rw-r--r--ChangeLog5
-rw-r--r--Doc/Zsh/expn.yo3
-rw-r--r--Etc/FAQ.yo9
3 files changed, 16 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 464c8846d..0d597c73c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-11-23  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* 33740: Stephane: Etc/FAQ.yo: Another way of avoiding MULTIO
+	effects on pipes.
+
 2014-11-22  Barton E. Schaefer  <schaefer@zsh.org>
 
 	* 33763 (cf. Baptiste Daroussin 33747): Doc/Zsh/mod_system.yo:
diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo
index a0478e78c..f1334e37a 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 7d4b86ec3..eeb7c13de 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 alternatively write the following:
+  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?)