summaryrefslogtreecommitdiffstats
path: root/tests/redir.right
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 18:33:23 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 18:33:23 +0000
commit1d5cace9db9aef76f26b2d7ba54bbb76443b00b2 (patch)
tree314a15dd1aa103da13bdc83ba1d2105a290bc5ba /tests/redir.right
parentInitial commit. (diff)
downloadbash-1d5cace9db9aef76f26b2d7ba54bbb76443b00b2.tar.xz
bash-1d5cace9db9aef76f26b2d7ba54bbb76443b00b2.zip
Adding upstream version 5.0.upstream/5.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/redir.right')
-rw-r--r--tests/redir.right148
1 files changed, 148 insertions, 0 deletions
diff --git a/tests/redir.right b/tests/redir.right
new file mode 100644
index 0000000..d4ab60d
--- /dev/null
+++ b/tests/redir.right
@@ -0,0 +1,148 @@
+abc
+./redir.tests: line 15: /tmp/redir-test: cannot overwrite existing file
+abc
+def
+def
+./redir.tests: line 31: $z: ambiguous redirect
+Point 1
+Point 2
+to a
+to b
+Point 3
+to a
+to a
+to b
+to b
+Point 4
+to c
+Point 5
+this is redir1.sub
+this is redir2.sub
+read line1 "ab"
+read line2 "root"
+read line3 "cd"
+read line4 "daemon"
+from stdin: aa
+to stdout
+./redir4.sub: line 32: $fd: ambiguous redirect
+./redir4.sub: line 33: $fd: ambiguous redirect
+err-and-out:
+to stdout
+to stderr
+err-and-out:
+to stdout
+to stderr
+0 -- 3 0
+0 -- 4 0
+ab
+cd
+ef
+gh
+ij
+kl
+0
+ab
+cd
+cd
+./redir.tests: line 157: 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 2>&1 | grep -q 'invalid file descriptor'
+echo after read
+
+exec 5<&0
+
+exec <&-
+
+read abcde 2>&1 | grep -q 'read error'
+
+exec 0<&9-
+read line
+echo $line
+f ()
+{
+ exec 5< $0;
+ exec 0<&5-;
+ while read line; do
+ echo "$line";
+ done
+}
+after read
+# 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
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+1
+7
+after: 42
+./redir11.sub: line 40: $(ss= declare -i ss): ambiguous redirect
+after: 42
+a+=3
+foo
+foo