abc
-./redir.tests: /tmp/redir-test: cannot overwrite existing file
+./redir.tests: line 15: /tmp/redir-test: cannot overwrite existing file
abc
def
def
-./redir.tests: $z: ambiguous redirect
+./redir.tests: line 31: $z: ambiguous redirect
Point 1
Point 2
to a
read line4 "daemon"
from stdin: aa
to stdout
-./redir4.sub: $fd: ambiguous redirect
-./redir4.sub: $fd: ambiguous redirect
+./redir4.sub: line 32: $fd: ambiguous redirect
+./redir4.sub: line 33: $fd: ambiguous redirect
/tmp/err-and-out:
to stdout
to stderr
ab
cd
cd
-./redir.tests: redir1.*: No such file or directory
+./redir.tests: line 154: redir1.*: No such file or directory
+# tests of ksh93-like dup-and-close redirection operators
+exec 9<$0
+
+f()
+{
+exec 5<$0
+
+exec 0<&5-
+
+while read line; do
+echo "$line"
+done
+}
+
+f
+
+typeset -f f
+
+# make sure it was closed
+read -u 5 foo
+echo after read
+
+exec 5<&0
+
+exec <&-
+
+read abcde
+
+exec 0<&9-
+read line
+echo $line
+f ()
+{
+ exec 5< $0;
+ exec 0<&5-;
+ while read line; do
+ echo "$line";
+ done
+}
+./redir5.sub: line 20: read: 5: invalid file descriptor: Bad file descriptor
+after read
+./redir5.sub: line 27: read: read error: 0: Bad file descriptor
+# tests of ksh93-like dup-and-close redirection operators
+/
+/
+/
+0
+0
+0
+before block
+after block
+c1 is 1
+c2 is 2
+c3 is 3
+c4 is 4
+fd 10
+fd 8
+fd 10
+fd 8
+1
+2
+3
+4
+1
+2
+3
+4
+cat /tmp/foo
+whatsis
+hey
+to stdout
+to stderr
+
+to stdout
+to stderr
+
+to stderr
+to stdout
+
+to stderr
+hey
+to stdout
+logfunc is a function
+logfunc ()
+{
+ echo "$@" &>> $TMPDIR/log
+}
+foo
+bix is a function
+bix ()
+{
+ echo foo 2>&1 | cat
+}
+foo
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::