From b3f8e32e5cf5771eb5efb1e11c38dab377b14432 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Tue, 12 Apr 2005 15:11:07 +0000 Subject: 21133: New {myfd} syntax for allocating file descriptors --- Test/A04redirect.ztst | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'Test') 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 + + 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 -- cgit 1.4.1