source: trunk/third/bash/examples/functions/inpath @ 12959

Revision 12959, 186 bytes checked in by tb, 26 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r12958, which included commits to RCS files with non-trunk default branches.
Line 
1inpath()
2{
3        local PROG
4        path=$(echo $PATH | sed 's/^:/.:/
5                                s/::/:.:/g
6                                s/:$/:./
7                                s/:/ /g')
8
9        for x in $path
10        do
11                [ -x $x/$1 ] && { PROG=$x/$1; break; }
12        done
13        [ -n "$PROG" ]
14}
Note: See TracBrowser for help on using the repository browser.