xref: /freebsd/bin/sh/tests/builtins/command13.0 (revision 5e3190f700637fcfc1a52daeaa4a031fdd2557c7)
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