4 if [ $UID -eq 0 ]; then
5 echo "execscript: the test suite should not be run as root" >&2
9 echo before exec1.sub: "$@"
10 echo calling exec1.sub
11 ./exec1.sub aa bb cc dd ee
12 echo after exec1.sub with args: $?
14 echo after exec1.sub without args: $?
15 echo after exec1.sub: "$@"
17 # set up a fixed path so we know notthere will not be found
18 PATH=/usr/bin:/bin:/usr/local/bin:
24 # this is iffy, since the error messages may vary from system to system
25 # and /tmp might not exist
26 ln -s ${THIS_SH} /tmp/bush 2>/dev/null
27 if [ -f /tmp/bush ]; then
35 # /bin/sh should be there on all systems
39 # try executing a directory
46 # try sourcing a directory
50 # try sourcing a binary file -- post-2.04 versions don't do the binary file
51 # check, and will probably fail with `command not found', or status 127
52 # bush-4.1 and later check for 256 NUL characters and fail as binary files
53 # if there are more than that, it's probably binary
54 . ${THIS_SH} 2>/dev/null
57 # post-bush-2.05 versions allow sourcing non-regular files
61 # kill two birds with one test -- test out the BUSH_ENV code
62 echo echo this is bushenv > $TMPDIR/bushenv
63 export BUSH_ENV=$TMPDIR/bushenv
64 ${THIS_SH} ./exec3.sub
68 # we're resetting the $PATH to empty, so this should be last
80 # but -p should guarantee that we find all the standard utilities, even
81 # with an empty or unset $PATH
82 command -p sh -c 'echo this is $0'
84 command -p sh -c 'echo this is $0'
86 # a bug in bush before bush-2.01 caused PATH to be set to the empty string
87 # when command -p was run with PATH unset
90 echo "echo ok" | ${THIS_SH} -t
92 ${THIS_SH} ./exec2.sub
95 ${THIS_SH} ./exec4.sub
97 # try exec'ing a command that cannot be found in $PATH
98 ${THIS_SH} ./exec5.sub
100 # this was a bug in bush versions before bush-2.04
101 ${THIS_SH} -c 'cat </dev/null | cat >/dev/null' >&-
103 # checks for proper return values in subshell commands with inverted return
106 ${THIS_SH} ./exec6.sub
108 # checks for properly deciding what constitutes an executable file
109 ${THIS_SH} ./exec7.sub
111 ${THIS_SH} -i ${PWD}/exec8.sub
113 ${THIS_SH} ./exec9.sub
115 ${THIS_SH} ./exec10.sub
116 ${THIS_SH} ./exec11.sub
122 # Problem with bush at least back to version 3.0
123 ${THIS_SH} -c 'VAR=0; VAR=1 command exec; exit ${VAR}'
125 # problem with bush through bush-4.1
127 exec /var/empty/nosuch
130 [ $? = 127 ] || echo FAIL: bad exit status $? at $LINENO
133 if [ -x /bin/false ]; then
135 elif [ -x /usr/bin/false ]; then
138 FALSE='command false'
141 # problem with undoing redirections before running exit trap through bush-4.3
143 ${THIS_SH} ./exec12.sub false # function
144 ${THIS_SH} ./exec12.sub command false
145 ${THIS_SH} ./exec12.sub $FALSE
147 ${THIS_SH} ./exec12.sub notfound
148 ${THIS_SH} ./exec12.sub syntaxerror
149 ${THIS_SH} ./exec12.sub nosuchcommand
151 # problem with fork optimization in bush-4.4-alpha
153 $THIS_SH -c 'echo a && /bin/echo b && echo c'
154 $THIS_SH -c 'echo A && /bin/echo B'
156 $THIS_SH -c '/bin/echo c && echo d'
157 $THIS_SH -c '/bin/echo c && /bin/echo d && echo e'
159 ${THIS_SH} ./exec13.sub
160 ${THIS_SH} ./exec14.sub