]> git.ipfire.org Git - thirdparty/bash.git/blob - tests/exec10.sub
Bash-4.4 distribution sources and documentation
[thirdparty/bash.git] / tests / exec10.sub
1 # post bash-4.3 changes to how command -p works (avoid modifying $PATH)
2
3 : ${TMPDIR=/tmp}
4 xpath=/usr/local/bin:/usr/GNU/bin:/usr/bin:/bin:.
5
6 # set a value of PATH we can test for; versions of bash up to and including
7 # bash-4.3 would set $PATH while running command -p
8 PATH=$xpath
9 export PATH
10 command -p sh -c 'echo $PATH'
11
12 PATH=${TMPDIR}
13 command -pv cat >/dev/null || echo "cannot find cat using standard path"
14 command -p cat < /dev/null
15 #hash
16
17 PATH=$xpath
18 command -pv cat >/dev/null || echo "cannot find cat using xpath"
19 PATH=$TMPDIR command -pv cat >/dev/null || echo "cannot find cat using standard path with PATH=\$TMPDIR"
20 PATH= command -pv cat >/dev/null || echo "cannot find cat using standard path with empty \$PATH"
21 PATH=$TMPDIR command -v cat >/dev/null || echo "cannot find cat in \$TMPDIR"
22 PATH= command -v cat >/dev/null || echo "cannot find cat with empty \$PATH"
23
24 echo PATH = $PATH
25 hash cat
26
27 PATH=$xpath
28
29 PATH=$TMPDIR command -pv cat >/dev/null || echo "cannot find cat using stdpath with hash"
30 PATH= command -pv cat >/dev/null || echo "cannot find cat using stdpath with hash"
31 PATH=$TMPDIR command -v cat >/dev/null || echo "cannot find cat in \$TMPDIR with hash"
32 PATH= command -v cat >/dev/null || echo "cannot find cat with empty \$PATH with hash"
33
34 echo PATH = $PATH