about summary refs log tree commit diff
path: root/Doc/Zsh/redirect.yo
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2005-04-12 15:11:07 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2005-04-12 15:11:07 +0000
commitb3f8e32e5cf5771eb5efb1e11c38dab377b14432 (patch)
treea0029fa908983c35956961f92cc51bda73487d93 /Doc/Zsh/redirect.yo
parentbd718425bb41f08fb9d06968b339455abb37e2dd (diff)
downloadzsh-b3f8e32e5cf5771eb5efb1e11c38dab377b14432.tar.gz
zsh-b3f8e32e5cf5771eb5efb1e11c38dab377b14432.tar.xz
zsh-b3f8e32e5cf5771eb5efb1e11c38dab377b14432.zip
21133: New {myfd} syntax for allocating file descriptors
Diffstat (limited to 'Doc/Zsh/redirect.yo')
-rw-r--r--Doc/Zsh/redirect.yo25
1 files changed, 25 insertions, 0 deletions
diff --git a/Doc/Zsh/redirect.yo b/Doc/Zsh/redirect.yo
index 167c3ef21..3ce4b4369 100644
--- a/Doc/Zsh/redirect.yo
+++ b/Doc/Zsh/redirect.yo
@@ -149,6 +149,31 @@ file descriptor 2 would be associated
 with the terminal (assuming file descriptor 1 had been)
 and then file descriptor 1 would be associated with file var(fname).
 
+If instead of a digit one of the operators above is preceded by
+a valid identifier enclosed in braces, the shell will open a new
+file descriptor that is guaranteed to be at least 10 and set the
+parameter named by the identifier to the file descriptor opened.
+No whitespace is allowed between the closing brace and the redirection
+character.  The option tt(IGNORE_BRACES) must not be set.
+For example:
+
+indent(... {myfd}>&1)
+
+This opens a new file descriptor that is a duplicate of file descriptor
+1 and sets the parameter tt(myfd) to the number of the file descriptor,
+which will be at least 10.  The new file descriptor can be written to using
+the syntax tt(>&$myfd).
+
+The syntax tt({)var(varid)tt(}>&-), for example tt({myfd}>&-), may be used
+to close a file descriptor opened in this fashion.  Note that the
+parameter given by var(varid) must previously be set to a file descriptor
+in this case.
+
+It is an error to open or close a file descriptor in this fashion when the
+parameter is readonly.  However, it is not an error to read or write a file
+descriptor using tt(<&$)var(param) or tt(>&$)var(param) if var(param) is
+readonly.
+
 The `tt(|&)' command separator described in
 ifzman(em(Simple Commands & Pipelines) in zmanref(zshmisc))\
 ifnzman(noderef(Simple Commands & Pipelines))