Imported from ../bash-2.04.tar.gz.
[platform/upstream/bash.git] / tests / execscript
1 export LC_ALL=C
2 export LANG=C
3
4 set -- one two three
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: $?
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
38 . ${THIS_SH} 2>/dev/null
39 echo $?
40
41 . /dev/null
42 echo $?
43
44 # kill two birds with one test -- test out the BASH_ENV code
45 echo echo this is bashenv > /tmp/bashenv
46 export BASH_ENV=/tmp/bashenv
47 ${THIS_SH} ./exec3.sub
48 rm -f /tmp/bashenv
49 unset BASH_ENV
50
51 # we're resetting the $PATH to empty, so this should be last
52 PATH=
53
54 notthere
55 echo $?
56
57 command notthere
58 echo $?
59
60 command -p notthere
61 echo $?
62
63 # but -p should guarantee that we find all the standard utilities, even
64 # with an empty or unset $PATH
65 command -p sh -c 'echo this is $0'
66 unset PATH
67 command -p sh -c 'echo this is $0'
68
69 # a bug in bash before bash-2.01 caused PATH to be set to the empty string
70 # when command -p was run with PATH unset
71 echo ${PATH-unset}
72
73 echo "echo ok" | ${THIS_SH} -t
74
75 ${THIS_SH} ./exec2.sub
76 echo $?
77
78 ${THIS_SH} ./exec4.sub
79
80 # try exec'ing a command that cannot be found in $PATH
81 ${THIS_SH} ./exec5.sub
82
83 # this was a bug in bash versions before bash-2.04
84 ${THIS_SH} -c 'cat </dev/null | cat >/dev/null' >&-