1 |
Mike Frysinger wrote: |
2 |
|
3 |
> > for foo in ${ROOT}/etc/openvpn/*/local.conf; do |
4 |
> > [ -e ${foo} ] && bar ${foo} |
5 |
> > done |
6 |
> |
7 |
> i'd say doing a loop is worse than a `ls` hack. |
8 |
|
9 |
Why do you think so? No external program on which you must rely, |
10 |
and if you put a "break" in there, the loop is just syntactical. |
11 |
Here is another possibility if you do not need positional |
12 |
parameters anymore: |
13 |
|
14 |
set -- "${ROOT}"/etc/openvpn/*/local.conf |
15 |
if test -e "${1}" |
16 |
then ... |
17 |
fi |
18 |
|
19 |
And if you do need, you can write a function: |
20 |
|
21 |
Test2() { |
22 |
test "${1}" "${2}" |
23 |
} |
24 |
|
25 |
if Test2 -e "${ROOT}"/etc/openvpn/*/local.conf |
26 |
then ... |
27 |
fi |