1
0
Fork 0
bash/examples/functions/inpath
Daniel Baumann fa1b3d3922
Adding upstream version 5.2.37.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-21 06:49:21 +02: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" ]
}