[aur-general] [AUR4] Single binary package for different architectures

Buce dmbuce at gmail.com
Thu Jun 25 17:24:03 UTC 2015


On Thu, Jun 25, 2015 at 12:07 PM, Patrick Burroughs <celti at celti.name>
wrote:

> On Thu, 25 Jun 2015 17:01:02 +0200 Johannes Löthberg
> <johannes at kyriasis.com> wrote:
>
> > On 25/06, Patrick Burroughs wrote:
> > >On Thu, 25 Jun 2015 13:17:49 +0100 Mauro Santos
> > ><registo.mailling at 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.
>


You'd be better off avoiding the eval and using indirection:

local source_array="source_$CARCH"
local tarball="${!source_array[0]}"


More information about the aur-general mailing list