Gentoo Archives: gentoo-dev

From: Mike Frysinger <vapier@g.o>
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 14:18:19
Message-Id: 201010131015.27901.vapier@gentoo.org
In Reply to: Re: [gentoo-dev] Re: [gentoo-commits] gentoo-x86 commit in net-misc/openvpn: ChangeLog openvpn-2.1.3.ebuild by Vaeth
1 On Wednesday, October 13, 2010 03:08:24 Vaeth wrote:
2 > Mike Frysinger wrote:
3 > > > for foo in ${ROOT}/etc/openvpn/*/local.conf; do
4 > > >
5 > > > [ -e ${foo} ] && bar ${foo}
6 > > >
7 > > > done
8 > >
9 > > i'd say doing a loop is worse than a `ls` hack.
10 >
11 > Why do you think so? No external program on which you must rely,
12 > and if you put a "break" in there, the loop is just syntactical.
13 > Here is another possibility if you do not need positional
14 > parameters anymore:
15 >
16 > set -- "${ROOT}"/etc/openvpn/*/local.conf
17 > if test -e "${1}"
18 > then ...
19 > fi
20 >
21 > And if you do need, you can write a function:
22 >
23 > Test2() {
24 > test "${1}" "${2}"
25 > }
26 >
27 > if Test2 -e "${ROOT}"/etc/openvpn/*/local.conf
28 > then ...
29 > fi
30
31 relying on an external program to get a single line of readable code is better
32 than multiple lines of code that attempt to do the same thing. your further
33 examples here are even worse on many levels.
34 -mike

Attachments

File name MIME type
signature.asc application/pgp-signature