Line | |
---|
1 | #########################################################################
|
---|
2 | #
|
---|
3 | # Subroutines for determining existence of / path to executables
|
---|
4 | #
|
---|
5 | #########################################################################
|
---|
6 |
|
---|
7 | findEXE() {
|
---|
8 | if test $# -lt 1
|
---|
9 | then
|
---|
10 | printFATAL "findEXE: insufficient arguments"
|
---|
11 | fi
|
---|
12 |
|
---|
13 | X="$PATH";
|
---|
14 | prog="$1";
|
---|
15 | OLD_IFS=${IFS}
|
---|
16 | IFS=':'; export IFS
|
---|
17 | for dir in $X; do
|
---|
18 | exe="$dir/$1"
|
---|
19 | if (test -f "$exe" || test -f "${exe}.exe")
|
---|
20 | then
|
---|
21 | EXECUTABLE="$exe"; export EXECUTABLE
|
---|
22 | IFS=${OLD_IFS}; export IFS
|
---|
23 | return 0
|
---|
24 | fi
|
---|
25 | done
|
---|
26 | IFS=${OLD_IFS}; export IFS
|
---|
27 | printINFO "Command $1 not found in \$PATH"
|
---|
28 | EXECUTABLE=""; export EXECUTABLE
|
---|
29 | }
|
---|
30 |
|
---|
31 | needEXE() {
|
---|
32 | # printINFO "Checking for $@"
|
---|
33 | for arg
|
---|
34 | do
|
---|
35 | findEXE "$arg"
|
---|
36 | test -z "$EXECUTABLE" && printFATAL "Need \"$arg\" in \$PATH"
|
---|
37 | done
|
---|
38 | return 0
|
---|
39 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.