On 16 February 2012 15:41, Patrick Lists <fedora-list@xxxxxxxxxxxxxxxxx> wrote: > On 16-02-12 12:13, Ian Malone wrote: >> >> On 16 February 2012 08:43, Patrick Lists<fedora-list@xxxxxxxxxxxxxxxxx> >> wrote: >>> >>> Hi, >>> >>> I am trying to do the following in bash: >>> >>> OPTIONS = ( alfa beta gamma ) >>> SUBOPTIONS_alfa = ( alfa0 alfa1 ) >>> count=0 >>> SETCOUNT = ${#SUBOPTIONS_${OPTIONS[$count]}[@]} >>> >> nameSUBOPTS=SUBOPTIONS_${OPTIONS[$count]}[@] >> tmpARR=(${!nameSUBOPTS}) #You need tmpARR, because the '#' expansion >> wont work with '!' >> SETCOUNT=${#tmpARR[@]} >> echo ${OPTIONS[$count]}:$SETCOUNT >> done > > > Thanks! I will try it out. It looks more sane that what I found myself which > apparently is challenging the bash gods to unleash their wrath if I use it: > > eval SETCOUNT=\${#SUBOPTIONS_${OPTIONS[$count]}[@]} > Yes, I'd meant to mention you could always use eval, but the quoting introduced by each additional layer of indirection will eventually cause brain damage. >> Finally, it's spelt 'alpha' ;) > > > Heh spelt or spelled? :) Universal law of pedantry in action... -- imalone -- users mailing list users@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org