]> git.ipfire.org Git - thirdparty/bash.git/blob - tests/redir.right
Bash-5.2-rc4 release
[thirdparty/bash.git] / tests / redir.right
1 abc
2 ./redir.tests: line 28: /tmp/redir-test: cannot overwrite existing file
3 abc
4 def
5 def
6 ./redir.tests: line 44: $z: ambiguous redirect
7 Point 1
8 Point 2
9 to a
10 to b
11 Point 3
12 to a
13 to a
14 to b
15 to b
16 Point 4
17 to c
18 Point 5
19 this is redir1.sub
20 this is redir2.sub
21 read line1 "ab"
22 read line2 "root"
23 read line3 "cd"
24 read line4 "daemon"
25 from stdin: aa
26 to stdout
27 ./redir4.sub: line 45: $fd: ambiguous redirect
28 ./redir4.sub: line 46: $fd: ambiguous redirect
29 err-and-out:
30 to stdout
31 to stderr
32 err-and-out:
33 to stdout
34 to stderr
35 0 -- 3 0
36 0 -- 4 0
37 ab
38 cd
39 ef
40 gh
41 ij
42 kl
43 0
44 ab
45 cd
46 cd
47 ./redir.tests: line 170: redir1.*: No such file or directory
48 # This program is free software: you can redistribute it and/or modify
49 # it under the terms of the GNU General Public License as published by
50 # the Free Software Foundation, either version 3 of the License, or
51 # (at your option) any later version.
52 #
53 # This program is distributed in the hope that it will be useful,
54 # but WITHOUT ANY WARRANTY; without even the implied warranty of
55 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
56 # GNU General Public License for more details.
57 #
58 # You should have received a copy of the GNU General Public License
59 # along with this program. If not, see <http://www.gnu.org/licenses/>.
60 #
61 # tests of ksh93-like dup-and-close redirection operators
62 exec 9<$0
63
64 f()
65 {
66 exec 5<$0
67
68 exec 0<&5-
69
70 while read line; do
71 echo "$line"
72 done
73 }
74
75 f
76
77 typeset -f f
78
79 # make sure it was closed
80 read -u 5 foo 2>&1 | grep -q 'invalid file descriptor'
81 echo after read
82
83 exec 5<&0
84
85 exec <&-
86
87 read abcde 2>&1 | grep -q 'read error'
88
89 exec 0<&9-
90 read line
91 echo $line
92 f ()
93 {
94 exec 5< $0;
95 exec 0<&5-;
96 while read line; do
97 echo "$line";
98 done
99 }
100 after read
101 # This program is free software: you can redistribute it and/or modify
102 /
103 /
104 /
105 0
106 0
107 0
108 before block
109 after block
110 c1 is 1
111 c2 is 2
112 c3 is 3
113 c4 is 4
114 fd 10
115 fd 8
116 fd 10
117 fd 8
118 1
119 2
120 3
121 4
122 1
123 2
124 3
125 4
126 cat /tmp/foo
127 whatsis
128 hey
129 to stdout
130 to stderr
131
132 to stdout
133 to stderr
134
135 to stderr
136 to stdout
137
138 to stderr
139 hey
140 to stdout
141 logfunc is a function
142 logfunc ()
143 {
144 echo "$@" &>> $TMPDIR/log
145 }
146 foo
147 bix is a function
148 bix ()
149 {
150 echo foo 2>&1 | cat
151 }
152 foo
153 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
154 1
155 7
156 after: 42
157 ./redir11.sub: line 53: $(ss= declare -i ss): ambiguous redirect
158 after: 42
159 a+=3
160 foo
161 foo
162 ./redir11.sub: line 75: 42: No such file or directory
163 42