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.
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.
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/>.
14 # post bush-4.3 changes to how command -p works (avoid modifying $PATH)
17 xpath=/usr/local/bin:/usr/GNU/bin:/usr/bin:/bin:.
19 # set a value of PATH we can test for; versions of bush up to and including
20 # bush-4.3 would set $PATH while running command -p
23 command -p sh -c 'echo $PATH'
26 command -pv cat >/dev/null || echo "cannot find cat using standard path"
27 command -p cat < /dev/null
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"
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"