4 # catch-all for remaining untested redirection stuff
7 echo abc > /tmp/redir-test
12 #this should be an error
13 echo def > /tmp/redir-test
16 # but this should succeed
17 echo def > /tmp/redir-test-2
21 echo def >| /tmp/redir-test
25 rm /tmp/redir-test /tmp/redir-test-2
27 # this should be an error
58 rm -f /tmp/bash-a /tmp/bash-b /tmp/bash-c
61 # Test the effect of input buffering on the shell's input
63 ${THIS_SH} < redir1.sub
65 # more open, close, duplicate file descriptors
66 ${THIS_SH} ./redir3.sub < ./redir3.in1
68 # still more redirections
69 ${THIS_SH} ./redir4.sub < redir4.in1
71 # various forms of null redirection
77 echo oops -- $1 not found
82 testf /tmp/null-redir-a
84 $EXIT > /tmp/null-redir-b
85 testf /tmp/null-redir-b
87 ( > /tmp/null-redir-c )
88 testf /tmp/null-redir-c
90 $EXIT > /tmp/null-redir-d &
92 testf /tmp/null-redir-d
94 exit 3 | $EXIT > /tmp/null-redir-e
95 echo $? -- ${PIPESTATUS[@]}
96 testf /tmp/null-redir-e
98 exit 4 | > /tmp/null-redir-f
99 echo $? -- ${PIPESTATUS[@]}
100 testf /tmp/null-redir-f
102 > /tmp/null-redir-g &
104 testf /tmp/null-redir-g
106 exec >/tmp/null-redir-h &
108 testf /tmp/null-redir-h
110 # make sure async commands don't get /dev/null as stdin when an explicit
111 # input redirection is supplied
113 { read line ; echo $line ; } &
115 { read line ; echo $line ; } &
126 # make sure async commands get /dev/null as stdin in the absence of any
132 # make sure that loops work OK with here documents and are not run in
143 # These should not echo anything -- bug in versions before 2.04
144 ( ( echo hello 1>&3 ) 3>&1 ) >/dev/null 2>&1
146 ( ( echo hello 1>&3 ) 3>&1 ) >/dev/null 2>&1 | cat
148 # in posix mode, non-interactive shells are not allowed to perform
149 # filename expansion on input redirections, even if they expand to
154 # test ksh93 dup-and-close (move fd) redirections
155 ${THIS_SH} ./redir5.sub
157 # test behavior after a write error with a builtin command
158 ${THIS_SH} ./redir6.sub