1 # post bash-4.3 changes to how command -p works (avoid modifying $PATH)
4 xpath=/usr/local/bin:/usr/GNU/bin:/usr/bin:/bin:.
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
10 command -p sh -c 'echo $PATH'
13 command -pv cat >/dev/null || echo "cannot find cat using standard path"
14 command -p cat < /dev/null
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"
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"