source: trunk/config.tests/unix/which.test@ 1030

Last change on this file since 1030 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

  • Property svn:executable set to *
File size: 629 bytes
Line 
1#!/bin/sh
2
3HOME=/dev/null
4export HOME
5
6unset which
7
8WHICH=`which which 2>/dev/null`
9if echo $WHICH | grep 'shell built-in command' >/dev/null 2>&1; then
10 WHICH=which
11elif [ -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;
19 fi
20 done
21 fi
22fi
23
24if [ -z "$WHICH" ]; then
25 IFS=:
26 for a in $PATH; do
27 if [ -x $a/$1 ]; then
28 echo "$a/$1"
29 exit 0
30 fi
31 done
32else
33 a=`"$WHICH" "$1" 2>/dev/null`
34 if [ ! -z "$a" -a -x "$a" ]; then
35 echo "$a"
36 exit 0
37 fi
38fi
39exit 1
Note: See TracBrowser for help on using the repository browser.