On Thu, 25 Jun 2015 17:01:02 +0200 Johannes Löthberg
<johan...@kyriasis.com> wrote:

> On 25/06, Patrick Burroughs wrote:
> >On Thu, 25 Jun 2015 13:17:49 +0100 Mauro Santos
> ><registo.maill...@gmail.com> wrote:
> >> Wouldn't just
> >>
> >> local tarball="${source_$CARCH[0]}"
> >>
> >> or something very similar do the job?
> >
> >I believe you need:
> >
> >local tarball=$(eval "echo \${source_${CARCH}[0]}")
> >
> 
> Why do you believe that?

A quick google and some personal testing showed me that the former
doesn't work and the latter does, because bash doesn't interpolate
variables in the middle of another variable like that; you need to use
eval to make a second pass for it to work. Rather hacky, though, and I
see no point in using it over the conditional construct proposed
earlier — I just hate to see a suggestion that doesn't work out there.

-- 
Patrick Burroughs (Celti) <ce...@celti.name>

Attachment: pgpxO4ZztuZp0.pgp
Description: PGP signature

Reply via email to