]> git.ipfire.org Git - thirdparty/bash.git/blame - tests/redir.right
Bash-5.2-rc4 release
[thirdparty/bash.git] / tests / redir.right
CommitLineData
d166f048 1abc
8868edaf 2./redir.tests: line 28: /tmp/redir-test: cannot overwrite existing file
d166f048
JA
3abc
4def
5def
8868edaf 6./redir.tests: line 44: $z: ambiguous redirect
d166f048
JA
7Point 1
8Point 2
9to a
10to b
11Point 3
12to a
13to a
14to b
15to b
16Point 4
17to c
18Point 5
19this is redir1.sub
20this is redir2.sub
21read line1 "ab"
22read line2 "root"
23read line3 "cd"
24read line4 "daemon"
25from stdin: aa
26to stdout
8868edaf
CR
27./redir4.sub: line 45: $fd: ambiguous redirect
28./redir4.sub: line 46: $fd: ambiguous redirect
d233b485 29err-and-out:
d166f048
JA
30to stdout
31to stderr
d233b485 32err-and-out:
d166f048
JA
33to stdout
34to stderr
350 -- 3 0
360 -- 4 0
37ab
38cd
39ef
40gh
41ij
42kl
430
44ab
45cd
46cd
8868edaf
CR
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#
7117c2d2
JA
61# tests of ksh93-like dup-and-close redirection operators
62exec 9<$0
63
64f()
65{
66exec 5<$0
67
68exec 0<&5-
69
70while read line; do
71echo "$line"
72done
73}
74
75f
76
77typeset -f f
78
79# make sure it was closed
d233b485 80read -u 5 foo 2>&1 | grep -q 'invalid file descriptor'
7117c2d2
JA
81echo after read
82
83exec 5<&0
84
85exec <&-
86
d233b485 87read abcde 2>&1 | grep -q 'read error'
7117c2d2
JA
88
89exec 0<&9-
90read line
91echo $line
92f ()
93{
0628567a 94 exec 5< $0;
7117c2d2
JA
95 exec 0<&5-;
96 while read line; do
97 echo "$line";
98 done
99}
7117c2d2 100after read
8868edaf 101# This program is free software: you can redistribute it and/or modify
b80f6443
JA
102/
103/
104/
1050
1060
1070
95732b49
JA
108before block
109after block
110c1 is 1
111c2 is 2
112c3 is 3
113c4 is 4
3185942a
JA
114fd 10
115fd 8
116fd 10
117fd 8
1181
1192
1203
1214
1221
1232
1243
1254
126cat /tmp/foo
127whatsis
128hey
129to stdout
130to stderr
131
132to stdout
133to stderr
134
135to stderr
136to stdout
137
138to stderr
139hey
140to stdout
141logfunc is a function
142logfunc ()
143{
ac50fbac 144 echo "$@" &>> $TMPDIR/log
3185942a
JA
145}
146foo
147bix is a function
148bix ()
149{
150 echo foo 2>&1 | cat
151}
152foo
ac50fbac 153::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
a0c0a00f 1541
a0c0a00f
CR
1557
156after: 42
8868edaf 157./redir11.sub: line 53: $(ss= declare -i ss): ambiguous redirect
a0c0a00f
CR
158after: 42
159a+=3
160foo
161foo
8868edaf
CR
162./redir11.sub: line 75: 42: No such file or directory
16342