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: $?
16 # set up a fixed path so we know notthere will not be found
17 PATH=/usr/bin:/bin:/usr/local/bin:
23 # this is iffy, since the error messages may vary from system to system
24 # and /tmp might not exist
25 ln -s ${THIS_SH} /tmp/bash 2>/dev/null
26 if [ -f /tmp/bash ]; then
34 # /bin/sh should be there on all systems
38 # try executing a directory
45 # try sourcing a directory
49 # try sourcing a binary file -- post-2.04 versions don't do the binary file
50 # check, and will probably fail with `command not found', or status 127
51 # bash-4.1 and later check for 256 NUL characters and fail as binary files
52 # if there are more than that, it's probably binary
53 . ${THIS_SH} 2>/dev/null
56 # post-bash-2.05 versions allow sourcing non-regular files
60 # kill two birds with one test -- test out the BASH_ENV code
61 echo echo this is bashenv > /tmp/bashenv
62 export BASH_ENV=/tmp/bashenv
63 ${THIS_SH} ./exec3.sub
67 # we're resetting the $PATH to empty, so this should be last
79 # but -p should guarantee that we find all the standard utilities, even
80 # with an empty or unset $PATH
81 command -p sh -c 'echo this is $0'
83 command -p sh -c 'echo this is $0'
85 # a bug in bash before bash-2.01 caused PATH to be set to the empty string
86 # when command -p was run with PATH unset
89 echo "echo ok" | ${THIS_SH} -t
91 ${THIS_SH} ./exec2.sub
94 ${THIS_SH} ./exec4.sub
96 # try exec'ing a command that cannot be found in $PATH
97 ${THIS_SH} ./exec5.sub
99 # this was a bug in bash versions before bash-2.04
100 ${THIS_SH} -c 'cat </dev/null | cat >/dev/null' >&-
102 # checks for proper return values in subshell commands with inverted return
105 ${THIS_SH} ./exec6.sub
107 # checks for properly deciding what constitutes an executable file
108 ${THIS_SH} ./exec7.sub
110 ${THIS_SH} -i ./exec8.sub
112 ${THIS_SH} ./exec9.sub
118 # Problem with bash at least back to version 3.0
119 ${THIS_SH} -c 'VAR=0; VAR=1 command exec; exit ${VAR}'
121 # problem with bash through bash-4.1
123 exec /var/empty/nosuch
126 [ $? = 127 ] || echo FAIL: bad exit status $? at $LINENO