Mike Frysinger wrote:
> > for foo in ${ROOT}/etc/openvpn/*/local.conf; do
> > [ -e ${foo} ] && bar ${foo}
> > done
>
> i'd say doing a loop is worse than a `ls` hack.
Why do you think so? No external program on which you must rely,
and if you put a "break" in there, the loop is just syntactical.
Here is another possibility if you do not need positional
parameters anymore:
set -- "${ROOT}"/etc/openvpn/*/local.conf
if test -e "${1}"
then ...
fi
And if you do need, you can write a function:
Test2() {
test "${1}" "${2}"
}
if Test2 -e "${ROOT}"/etc/openvpn/*/local.conf
then ...
fi