BASH-Adding array element: Naming issue using array[${#array[*]}]=5

view story

http://www.linuxquestions.org – I am writing a bash script and according to interwebs, when trying to add an element to an array, the syntax is as follows: array[${#array[*]}]=5 In my case, the array name changes depending on which loop iteration we are on... and I use variable affCtr as my counter to determine which array I will be appending to. So it should technically look something like this: core${affCtr}[${#core${affCtr}[*]}]=$tempID The problem is highlighted-- when I introduce that additional '$' since I want to use a variable there, I somehow lose the meaning of what the '*' should be. Do you guys have any id (HowTos)