1
0
Fork 0
mirror of synced 2025-03-06 20:53:29 +01:00
bash-shxdumper/examples/functions/inpath
2009-09-12 16:46:51 +00:00

14 lines
186 B
Text

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