summary refs log tree commit diff
path: root/Doc
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2016-04-04 14:53:11 +0100
committerPeter Stephenson <pws@zsh.org>2016-04-04 14:53:11 +0100
commitcaff72941d86983b44103653895328b411b29b4e (patch)
treed0579bdb0ba0aea995757f5ed1654a408269097f /Doc
parent1ea94513cc329c682d1afeaecd3bbfc3c66882ab (diff)
downloadzsh-caff72941d86983b44103653895328b411b29b4e.tar.gz
zsh-caff72941d86983b44103653895328b411b29b4e.tar.xz
zsh-caff72941d86983b44103653895328b411b29b4e.zip
38236: Order of redirections is important.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/Zsh/redirect.yo19
1 files changed, 19 insertions, 0 deletions
diff --git a/Doc/Zsh/redirect.yo b/Doc/Zsh/redirect.yo
index 35fa773fd..66160a61e 100644
--- a/Doc/Zsh/redirect.yo
+++ b/Doc/Zsh/redirect.yo
@@ -234,6 +234,25 @@ example(date >foo | cat)
 
 writes the date to the file `tt(foo)', and also pipes it to cat.
 
+Note also that redirections are always expanded in order.  This happens
+regardless of the setting of the tt(MULTIOS) option, but with the option
+in effect there are additional consequences. For example,
+the meaning of the expression tt(>&1) will change after a previous
+redirection:
+
+example(date >&1 >output)
+
+In the case above, the tt(>&1) refers to the standard output at the
+start of the line; the result is similar to the tt(tee) command.
+However, consider:
+
+exmaple(date >output >&1)
+
+As redirections are evaluated in order, when the tt(>&1) is encountered
+the standard output is set to the file tt(output) and another copy of
+the output is therefore sent to that file.  This is unlikely to be what
+is intended.
+
 If the tt(MULTIOS)
 option is set, the word after a redirection operator is also subjected
 to filename generation (globbing).  Thus