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

So give it a better name. :-)  In this case 'ls' shouldn't hurt anybody,
but such function solves problem in much more elegant manner -
regardless it's definied in an ebuild or eclass.
-- 
Amadeusz Żołnowski

PGP key fpr: C700 CEDE 0C18 212E 49DA  4653 F013 4531 E1DB FAB5

Attachment: signature.asc
Description: PGP signature

Reply via email to