]> git.ipfire.org Git - thirdparty/bash.git/blob - tests/exec10.sub
Bash-5.2-rc4 release
[thirdparty/bash.git] / tests / exec10.sub
1 # This program is free software: you can redistribute it and/or modify
2 # it under the terms of the GNU General Public License as published by
3 # the Free Software Foundation, either version 3 of the License, or
4 # (at your option) any later version.
5 #
6 # This program is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 # GNU General Public License for more details.
10 #
11 # You should have received a copy of the GNU General Public License
12 # along with this program. If not, see <http://www.gnu.org/licenses/>.
13 #
14 # post bash-4.3 changes to how command -p works (avoid modifying $PATH)
15
16 : ${TMPDIR=/tmp}
17 xpath=/usr/local/bin:/usr/GNU/bin:/usr/bin:/bin:.
18
19 # set a value of PATH we can test for; versions of bash up to and including
20 # bash-4.3 would set $PATH while running command -p
21 PATH=$xpath
22 export PATH
23 command -p sh -c 'echo $PATH'
24
25 PATH=${TMPDIR}
26 command -pv cat >/dev/null || echo "cannot find cat using standard path"
27 command -p cat < /dev/null
28 #hash
29
30 PATH=$xpath
31 command -pv cat >/dev/null || echo "cannot find cat using xpath"
32 PATH=$TMPDIR command -pv cat >/dev/null || echo "cannot find cat using standard path with PATH=\$TMPDIR"
33 PATH= command -pv cat >/dev/null || echo "cannot find cat using standard path with empty \$PATH"
34 PATH=$TMPDIR command -v cat >/dev/null || echo "cannot find cat in \$TMPDIR"
35 PATH= command -v cat >/dev/null || echo "cannot find cat with empty \$PATH"
36
37 echo PATH = $PATH
38 hash cat
39
40 PATH=$xpath
41
42 PATH=$TMPDIR command -pv cat >/dev/null || echo "cannot find cat using stdpath with hash"
43 PATH= command -pv cat >/dev/null || echo "cannot find cat using stdpath with hash"
44 PATH=$TMPDIR command -v cat >/dev/null || echo "cannot find cat in \$TMPDIR with hash"
45 PATH= command -v cat >/dev/null || echo "cannot find cat with empty \$PATH with hash"
46
47 echo PATH = $PATH