6
# catch-all for remaining untested redirection stuff
9
echo abc > /tmp/redir-test
14
#this should be an error
15
echo def > /tmp/redir-test
18
# but this should succeed
19
echo def > /tmp/redir-test-2
23
echo def >| /tmp/redir-test
27
rm /tmp/redir-test /tmp/redir-test-2
29
# this should be an error
55
exec 6<>$TMPDIR/bash-c
60
rm -f $TMPDIR/bash-a $TMPDIR/bash-b $TMPDIR/bash-c
63
# Test the effect of input buffering on the shell's input
65
${THIS_SH} < redir1.sub
67
# more open, close, duplicate file descriptors
68
${THIS_SH} ./redir3.sub < ./redir3.in1
70
# still more redirections
71
${THIS_SH} ./redir4.sub < redir4.in1
73
# various forms of null redirection
79
echo oops -- $1 not found
83
> $TMPDIR/null-redir-a
84
testf $TMPDIR/null-redir-a
86
$EXIT > $TMPDIR/null-redir-b
87
testf $TMPDIR/null-redir-b
89
( > $TMPDIR/null-redir-c )
90
testf $TMPDIR/null-redir-c
92
$EXIT > $TMPDIR/null-redir-d &
94
testf $TMPDIR/null-redir-d
96
exit 3 | $EXIT > $TMPDIR/null-redir-e
97
echo $? -- ${PIPESTATUS[@]}
98
testf $TMPDIR/null-redir-e
100
exit 4 | > $TMPDIR/null-redir-f
101
echo $? -- ${PIPESTATUS[@]}
102
testf $TMPDIR/null-redir-f
104
> $TMPDIR/null-redir-g &
106
testf $TMPDIR/null-redir-g
108
exec >$TMPDIR/null-redir-h &
110
testf $TMPDIR/null-redir-h
112
# make sure async commands don't get /dev/null as stdin when an explicit
113
# input redirection is supplied
115
{ read line ; echo $line ; } &
117
{ read line ; echo $line ; } &
128
# make sure async commands get /dev/null as stdin in the absence of any
134
# make sure that loops work OK with here documents and are not run in
145
# These should not echo anything -- bug in versions before 2.04
146
( ( echo hello 1>&3 ) 3>&1 ) >/dev/null 2>&1
148
( ( echo hello 1>&3 ) 3>&1 ) >/dev/null 2>&1 | cat
150
# in posix mode, non-interactive shells are not allowed to perform
151
# filename expansion on input redirections, even if they expand to
156
# test ksh93 dup-and-close (move fd) redirections
157
${THIS_SH} ./redir5.sub
159
# test behavior after a write error with a builtin command
160
${THIS_SH} ./redir6.sub
162
# problem with redirections using fds bash uses internally
165
trap 'rm -f $TMPDIR/bash-redir-$$' 0 1 2 3 6 15
172
} > $TMPDIR/bash-redir-$$
176
${THIS_SH} ./redir7.sub
178
${THIS_SH} ./redir8.sub
181
command exec 2>$TMPDIR/foo-$$
189
${THIS_SH} ./redir9.sub
191
${THIS_SH} ./redir10.sub