lkml.org 
[lkml]   [2000]   [Sep]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: 2.2.18pre12 fix for some distros
Date
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/

\
 
 \ /
  Last update: 2005-03-22 12:39    [W:0.074 / U:3.424 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site