i-bash/examples/functions/inpath

15 lines
186 B
Text
Raw Normal View History

1996-12-23 17:02:34 +00:00
inpath()
{
1998-04-17 19:52:44 +00:00
local PROG
1996-12-23 17:02:34 +00:00
path=$(echo $PATH | sed 's/^:/.:/
s/::/:.:/g
s/:$/:./
s/:/ /g')
for x in $path
do
[ -x $x/$1 ] && { PROG=$x/$1; break; }
done
1998-04-17 19:52:44 +00:00
[ -n "$PROG" ]
1996-12-23 17:02:34 +00:00
}