Gentoo Archives: gentoo-dev

From: Vaeth <vaeth@××××××××××××××××××××××××.de>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Re: [gentoo-commits] gentoo-x86 commit in net-misc/openvpn: ChangeLog openvpn-2.1.3.ebuild
Date: Wed, 13 Oct 2010 07:08:34
Message-Id: Pine.LNX.4.64.1010130859060.13869@wmax001.mathematik.uni-wuerzburg.de
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

Replies