1 |
On Wednesday, October 13, 2010 04:23:16 Amadeusz Żołnowski wrote: |
2 |
> Excerpts from Mike Frysinger's message of Tue Oct 12 22:57:11 +0200 2010: |
3 |
> > On Tuesday, October 12, 2010 16:26:31 Jeroen Roovers wrote: |
4 |
> > > On Tue, 12 Oct 2010 22:09:06 +0200 Dirkjan Ochtman wrote: |
5 |
> > > > On Fri, Oct 1, 2010 at 15:07, Peter Volkov wrote: |
6 |
> > > > > [a very thorough review of the openvpn ebuild] |
7 |
> > > > |
8 |
> > > > Thanks for reviewing, I've fixed most of the issues. |
9 |
> > > > |
10 |
> > > > >> if [[ -n $(ls /etc/openvpn/*/local.conf 2>/dev/null) ]] ; |
11 |
> > > > >> |
12 |
> > > > >> then |
13 |
> > > > > |
14 |
> > > > > I'd suggested [ -e /etc/openvpn/*/local.conf ] here, but probably |
15 |
> > > > > there are better alternatives. Also ${ROOT} is missed here. |
16 |
> > > > |
17 |
> > > > I've put ${ROOT} in, are there no better alternatives? I don't think |
18 |
> > > > anyone mentioned any. |
19 |
> > > |
20 |
> > > for foo in ${ROOT}/etc/openvpn/*/local.conf; do |
21 |
> > > |
22 |
> > > [ -e ${foo} ] && bar ${foo} |
23 |
> > > |
24 |
> > > done |
25 |
> > > |
26 |
> > > If no ${ROOT}/etc/openvpn/*/local.conf is found, it returns the exact |
27 |
> > > string; which doesn't exist so Nothing Happens. |
28 |
> > |
29 |
> > i'd say doing a loop is worse than a `ls` hack. and this has quoting |
30 |
> > problems, but that's ancillary ... |
31 |
|
32 |
> What about defining following function? |
33 |
> |
34 |
> any_exists() { |
35 |
> local f |
36 |
> |
37 |
> for f; do |
38 |
> [[ -e $f ]] && return 0 |
39 |
> done |
40 |
> |
41 |
> return 1 |
42 |
> } |
43 |
|
44 |
perhaps if it had a better name and were in a common location (eclass) |
45 |
-mike |