]> git.ipfire.org Git - thirdparty/bash.git/blame - tests/execscript
Imported from ../bash-2.05.tar.gz.
[thirdparty/bash.git] / tests / execscript
CommitLineData
d166f048
JA
1export LC_ALL=C
2export LANG=C
3
4set -- one two three
cce855bc
JA
5echo before exec1.sub: "$@"
6echo calling exec1.sub
7./exec1.sub aa bb cc dd ee
8echo after exec1.sub with args: $?
9./exec1.sub
10echo after exec1.sub without args: $?
d166f048
JA
11
12# set up a fixed path so we know notthere will not be found
13PATH=/usr/bin:/bin:/usr/local/bin:
14export PATH
15
16notthere
17echo $?
18
19# this is iffy, since the error messages may vary from system to system
20${THIS_SH} notthere
21echo $?
22
23# /bin/sh should be there on all systems
24${THIS_SH} /bin/sh
25echo $?
26
27# try executing a directory
28/
29echo $?
30
31${THIS_SH} /
32echo $?
33
34# try sourcing a directory
35. /
36echo $?
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
41echo $?
42
43. /dev/null
44echo $?
45
46# kill two birds with one test -- test out the BASH_ENV code
47echo echo this is bashenv > /tmp/bashenv
48export BASH_ENV=/tmp/bashenv
cce855bc 49${THIS_SH} ./exec3.sub
d166f048
JA
50rm -f /tmp/bashenv
51unset BASH_ENV
52
53# we're resetting the $PATH to empty, so this should be last
54PATH=
55
56notthere
57echo $?
58
59command notthere
60echo $?
61
62command -p notthere
63echo $?
64
65# but -p should guarantee that we find all the standard utilities, even
66# with an empty or unset $PATH
67command -p sh -c 'echo this is $0'
68unset PATH
69command -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
73echo ${PATH-unset}
74
75echo "echo ok" | ${THIS_SH} -t
76
cce855bc 77${THIS_SH} ./exec2.sub
d166f048
JA
78echo $?
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