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