xref: /freebsd/bin/sh/tests/builtins/command13.0 (revision eac7052fdebb90caf2f653e06187bdbca837b9c7)
1# $FreeBSD$
2
3failures=0
4
5check() {
6	if [ "$1" != "$2" ] && { [ "$#" -lt 3 ] || [ "$1" != "$3" ]; } then
7		echo "Mismatch found"
8		echo "Expected: $2"
9		if [ "$#" -ge 3 ]; then
10			echo "Alternative expected: $3"
11		fi
12		echo "Actual: $1"
13		: $((failures += 1))
14	fi
15}
16
17check "$(cd /bin && PATH=. command -v ls)" /bin/ls /bin/./ls
18check "$(cd /bin && PATH=:/var/empty/nosuch command -v ls)" /bin/ls /bin/./ls
19check "$(cd / && PATH=bin command -v ls)" /bin/ls
20check "$(cd / && command -v bin/ls)" /bin/ls
21check "$(cd /bin && command -v ./ls)" /bin/ls /bin/./ls
22