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