Re: 2.2.18pre12 fix for some distros

From: Miquel van Smoorenburg (miquels@cistron.nl)
Date: Sat Sep 30 2000 - 11:19:44 EST


In article <E13fNNw-0002Iq-00@the-village.bc.nu>,
Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
>I'll play with the proposed which based fixes first, unless you have clever
>ideas ?

Include a script in scripts/kwhich that tells you the path to
a certain binary.

Below is a simple implementation. If you condense it you can
even include it in the Makefile verbatim, though a seperate script
seems cleaner to me.

% ./kwhich unknowncc gcc272 gcc cc
/usr/bin/gcc272

#! /bin/sh

# kwhich 1.0 (C) 2000 Miquel van Smoorenburg
# This program is GPLed

if [ $# -lt 1 ]
then
        echo "Usage: $0 cmd [cmd..]" >&2
        exit 1
fi

IFS=:
for cmd in $*
do
        for path in $PATH
        do
                if [ -x "$path/$cmd" ]
                then
                        echo "$path/$cmd"
                        exit 0
                fi
        done
done

echo "$*: not found" >&2
exit 1

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Sep 30 2000 - 21:00:27 EST