Revision 12455,
741 bytes
checked in by danw, 26 years ago
(diff) |
This commit was generated by cvs2svn to compensate for changes in r12454,
which included commits to RCS files with non-trunk default branches.
|
-
Property svn:executable set to
*
|
Line | |
---|
1 | #! /bin/sh |
---|
2 | # |
---|
3 | # mhn.find.sh -- check if a particular command is available |
---|
4 | # |
---|
5 | # $Id: mhn.find.sh,v 1.1.1.1 1999-02-07 18:14:19 danw Exp $ |
---|
6 | |
---|
7 | if test -z "$2"; then |
---|
8 | echo "usage: mhn.find.sh search-path program" 1>&2 |
---|
9 | exit 1 |
---|
10 | fi |
---|
11 | |
---|
12 | # PATH to search for programs |
---|
13 | SEARCHPATH=$1 |
---|
14 | |
---|
15 | # program to search for |
---|
16 | PROGRAM=$2 |
---|
17 | |
---|
18 | PGM= oIFS="$IFS" IFS=":" |
---|
19 | for A in $SEARCHPATH; do |
---|
20 | |
---|
21 | # skip the directories `.' and `..' |
---|
22 | if test "$A" = "." -o "$A" = ".."; then |
---|
23 | continue |
---|
24 | fi |
---|
25 | |
---|
26 | # if program was found in /usr/local/bin, then |
---|
27 | # just echo program name, else echo full pathname |
---|
28 | if test -f "$A/$PROGRAM"; then |
---|
29 | if test "$A" = "/usr/local/bin"; then |
---|
30 | PGM="$PROGRAM" |
---|
31 | else |
---|
32 | PGM="$A/$PROGRAM" |
---|
33 | fi |
---|
34 | |
---|
35 | echo "$PGM" |
---|
36 | exit 0 |
---|
37 | fi |
---|
38 | done |
---|
39 | IFS="$oIFS" |
---|
40 | |
---|
Note: See
TracBrowser
for help on using the repository browser.