You can't really handle arrays natively in the standard (Bourne) shell.
See here for more details.
The C shell ( 47.5 ) , awk ( 33.11 ) , the Korn shell, and some other
UNIX command interpreters have built-in array support. The standard
Bourne shell doesn't, though its command line is a sort-of array that
you can store with the set ( 44.19 ) command - and get stored values
through $1 , $2 , etc.
I would try and use bash (as you've identified) or a more fully featured scripting language such as Perl (no doubt others will suggest their favourites!)