I have been trying to get a better grasp of some advanced bash concepts, and have been reading through the following reference manual. I am pretty familiar with C and perl arrays, but have never had a need to use arrays in a bash script. The syntax for a bash array is almost identical to Perl:
array[1]=12
echo ${array[1]}
This assigns the value 12 to the first slot in the array. Since bash variables are untyped, we can assign a string to the same array:
array[2]="my string"
echo ${array[2]}
This assigns the string “my string” to slot two in the array. Useful stuff!