In article <[EMAIL PROTECTED]>,
Alan Cox  <[EMAIL PROTECTED]> 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 [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/

Reply via email to