xref: /freebsd/bin/sh/tests/builtins/command7.0 (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1
2failures=0
3
4check() {
5	if ! eval "[ $* ]"; then
6		echo "Failed: $*"
7		: $((failures += 1))
8	fi
9}
10
11check '"$(PATH=/libexec command -V ld-elf.so.1)" = "ld-elf.so.1 is /libexec/ld-elf.so.1"'
12check '"$(PATH=/libexec command -V ld-elf.so.1; :)" = "ld-elf.so.1 is /libexec/ld-elf.so.1"'
13check '"$(PATH=/libexec command -pv ld-elf.so.1)" = ""'
14check '"$(PATH=/libexec command -pv ld-elf.so.1; :)" = ""'
15
16PATH=/libexec:$PATH
17
18check '"$(command -V ld-elf.so.1)" = "ld-elf.so.1 is /libexec/ld-elf.so.1"'
19check '"$(command -V ld-elf.so.1; :)" = "ld-elf.so.1 is /libexec/ld-elf.so.1"'
20check '"$(command -pv ld-elf.so.1)" = ""'
21check '"$(command -pv ld-elf.so.1; :)" = ""'
22
23PATH=/libexec
24
25check '"$(command -v ls)" = ""'
26case $(command -pv ls) in
27/*/ls) ;;
28*)
29	echo "Failed: \$(command -pv ls) match /*/ls"
30	: $((failures += 1)) ;;
31esac
32
33exit $((failures > 0))
34