source: vendor/bash/3.1-p17/examples/scripts/inpath

Last change on this file was 3228, checked in by bird, 18 years ago

bash 3.1

File size: 296 bytes
Line 
1#! /bin/sh
2#
3# Search $PATH for a file the same name as $1; return TRUE if found.
4#
5
6command=$1
7[ -n "$command" ] || exit 1
8
9set `echo $PATH | sed 's/^:/.:/
10 s/::/:.:/g
11 s/:$/:./
12 s/:/ /g'`
13
14while [ $# -ne 0 ] ; do
15 [ -f $1/$command ] && exit 0 # test -x not universal
16 shift
17done
18
19exit 1
Note: See TracBrowser for help on using the repository browser.