diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2005-04-12 15:11:07 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2005-04-12 15:11:07 +0000 |
commit | b3f8e32e5cf5771eb5efb1e11c38dab377b14432 (patch) | |
tree | a0029fa908983c35956961f92cc51bda73487d93 /Test | |
parent | bd718425bb41f08fb9d06968b339455abb37e2dd (diff) | |
download | zsh-b3f8e32e5cf5771eb5efb1e11c38dab377b14432.tar.gz zsh-b3f8e32e5cf5771eb5efb1e11c38dab377b14432.tar.xz zsh-b3f8e32e5cf5771eb5efb1e11c38dab377b14432.zip |
21133: New {myfd} syntax for allocating file descriptors
Diffstat (limited to 'Test')
-rw-r--r-- | Test/A04redirect.ztst | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Test/A04redirect.ztst b/Test/A04redirect.ztst index e4e8783f9..b85d6ecf5 100644 --- a/Test/A04redirect.ztst +++ b/Test/A04redirect.ztst @@ -235,3 +235,28 @@ 0:null redir with NULLCMD=cat <input >input + + exec {myfd}>logfile + print This is my logfile. >&$myfd + print Examining contents of logfile... + cat logfile +0:Using {fdvar}> syntax to open a new file descriptor +>Examining contents of logfile... +>This is my logfile. + + exec {myfd}>&- + print This message should disappear >&$myfd +1q:Closing file descriptor using brace syntax +?(eval):2: $myfd: bad file descriptor + + typeset -r myfd + echo This should not appear {myfd}>nologfile +1:Error opening file descriptor using readonly variable +?(eval):2: read-only variable: myfd + + typeset +r myfd + exec {myfd}>newlogfile + typeset -r myfd + exec {myfd}>&- +1:Error closing file descriptor using readonly variable +?(eval):4: can't close file descriptor from readonly parameter |