i-bash/examples/functions/inpath
2009-09-12 16:46:49 +00:00

15 lines
183 B
Text

inpath()
{
path=$(echo $PATH | sed 's/^:/.:/
s/::/:.:/g
s/:$/:./
s/:/ /g')
for x in $path
do
[ -x $x/$1 ] && { PROG=$x/$1; break; }
done
[ -z "$PROG" ]
return
}