]>
Commit | Line | Data |
---|---|---|
d166f048 JA |
1 | export LC_ALL=C |
2 | export LANG=C | |
3 | ||
4 | set -- one two three | |
cce855bc JA |
5 | echo before exec1.sub: "$@" |
6 | echo calling exec1.sub | |
7 | ./exec1.sub aa bb cc dd ee | |
8 | echo after exec1.sub with args: $? | |
9 | ./exec1.sub | |
10 | echo after exec1.sub without args: $? | |
d166f048 JA |
11 | |
12 | # set up a fixed path so we know notthere will not be found | |
13 | PATH=/usr/bin:/bin:/usr/local/bin: | |
14 | export PATH | |
15 | ||
16 | notthere | |
17 | echo $? | |
18 | ||
19 | # this is iffy, since the error messages may vary from system to system | |
20 | ${THIS_SH} notthere | |
21 | echo $? | |
22 | ||
23 | # /bin/sh should be there on all systems | |
24 | ${THIS_SH} /bin/sh | |
25 | echo $? | |
26 | ||
27 | # try executing a directory | |
28 | / | |
29 | echo $? | |
30 | ||
31 | ${THIS_SH} / | |
32 | echo $? | |
33 | ||
34 | # try sourcing a directory | |
35 | . / | |
36 | echo $? | |
37 | ||
28ef6c31 JA |
38 | # try sourcing a binary file -- post-2.04 versions don't do the binary file |
39 | # check, and will probably fail with `command not found', or status 127 | |
d166f048 JA |
40 | . ${THIS_SH} 2>/dev/null |
41 | echo $? | |
42 | ||
43 | . /dev/null | |
44 | echo $? | |
45 | ||
46 | # kill two birds with one test -- test out the BASH_ENV code | |
47 | echo echo this is bashenv > /tmp/bashenv | |
48 | export BASH_ENV=/tmp/bashenv | |
cce855bc | 49 | ${THIS_SH} ./exec3.sub |
d166f048 JA |
50 | rm -f /tmp/bashenv |
51 | unset BASH_ENV | |
52 | ||
53 | # we're resetting the $PATH to empty, so this should be last | |
54 | PATH= | |
55 | ||
56 | notthere | |
57 | echo $? | |
58 | ||
59 | command notthere | |
60 | echo $? | |
61 | ||
62 | command -p notthere | |
63 | echo $? | |
64 | ||
65 | # but -p should guarantee that we find all the standard utilities, even | |
66 | # with an empty or unset $PATH | |
67 | command -p sh -c 'echo this is $0' | |
68 | unset PATH | |
69 | command -p sh -c 'echo this is $0' | |
70 | ||
71 | # a bug in bash before bash-2.01 caused PATH to be set to the empty string | |
72 | # when command -p was run with PATH unset | |
73 | echo ${PATH-unset} | |
74 | ||
75 | echo "echo ok" | ${THIS_SH} -t | |
76 | ||
cce855bc | 77 | ${THIS_SH} ./exec2.sub |
d166f048 JA |
78 | echo $? |
79 | ||
cce855bc JA |
80 | ${THIS_SH} ./exec4.sub |
81 | ||
82 | # try exec'ing a command that cannot be found in $PATH | |
83 | ${THIS_SH} ./exec5.sub | |
bb70624e JA |
84 | |
85 | # this was a bug in bash versions before bash-2.04 | |
86 | ${THIS_SH} -c 'cat </dev/null | cat >/dev/null' >&- | |
28ef6c31 JA |
87 | |
88 | # checks for proper return values in subshell commands with inverted return | |
89 | # values | |
90 | ||
91 | ${THIS_SH} ./exec6.sub |