repo.or.cz
/
bash.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Patch-ID: bash40-021
[bash.git]
/
examples
/
scripts
/
inpath
blob
95f28bc1652185125b0d4e4021e3fe3f5e87d784
1
#! /bin/sh
2
#
3
# Search $PATH for a file the same name as $1; return TRUE if found.
4
#
5
6
command
=
$1
7
[
-n
"
$command
"
]
||
exit
1
8
9
set
`echo
$PATH
| sed 's/^:/.:/
10
s/::/:.:/g
11
s/:$/:./
12
s/:/ /g'`
13
14
while
[
$#
-ne
0
] ;
do
15
[
-f
$1
/
$command
] &&
exit
0
# test -x not universal
16
shift
17
done
18
19
exit
1