How to make dynamic variable names for use in while loop?

i=0
while [ $i -lt $numberofproducts]
do

sizesfor0=`cat 16 | grep 'pickSize' -A 1 | grep '_sz' | cut -d'_' -f1`
sizesfor0=${sizesfor0//id=\"lll/:}
IFS=: array0=( $sizesfor0 )
echo ${array0[1]}
 i=$(( $i + 1 ))

done

So, right now I have two variables in the while statement above

sizesfor0 and array0

The above statement works, but it is hard-coded with the 0 suffix, how does one turn the above variables into sizesfor$i and array$i so that I can add 1 after each iteration to make the while loop functional?

I've tried doing exactly that, (changing to sizesfor$i and array$i) but there are compatibility issues.

I'm leery enough about jamming everything into one variable, jamming multiple lines into multiple arrays -- plus your useless use of cat | awk | sed | cut | kitchen | sink makes me think you might be attacking this problem from the wrong angle.

This is shell. You don't have easy, complex datatypes, and array$i doesn't work and never will. The hacks that would allow it to work are invariably gargantuan security holes because the same code that would allow you to evaluate array$i would also evaluate array`rm -Rf ~/home`. You don't want to worry about arbitrary code execution every time you want to use an array.

If I absolutely had to store all that information I'd use one array. It's just as easy to split it later as it is this instant, so just put everything in the one array.

while [ $i -lt $numberofproducts ]
do
        ARR[$i]=whatever
done

But ideally, you could do your actual processing in that loop instead of storing everything and doing your processing later.