Fix breakage introduced in 21e0423a5c9ecd9da8e141dcfba25e60b55f7fe5
[qt-netbsd.git] / config.tests / unix / which.test
blob37c858c2f7d015add010092b9fb1b4ed85209910
1 #!/bin/sh
3 HOME=/dev/null
4 export HOME
6 unset which
8 WHICH=`which which 2>/dev/null`
9 if echo $WHICH | grep 'shell built-in command' >/dev/null 2>&1; then
10 WHICH=which
11 elif [ -z "$WHICH" ]; then
12 if which which >/dev/null 2>&1; then
13 WHICH=which
14 else
15 for a in /usr/ucb /usr/bin /bin /usr/local/bin; do
16 if [ -x $a/which ]; then
17 WHICH=$a/which
18 break;
20 done
24 if [ -z "$WHICH" ]; then
25 IFS=:
26 for a in $PATH; do
27 if [ -x $a/$1 ]; then
28 echo "$a/$1"
29 exit 0
31 done
32 else
33 a=`"$WHICH" "$1" 2>/dev/null`
34 if [ ! -z "$a" -a -x "$a" ]; then
35 echo "$a"
36 exit 0
39 exit 1