If we search the
bash man page for the word array, we find many instances in which
bash makes use of array variables. Most of these are rather obscure, but they may provide occasional utility in some special circumstances. In fact, the entire topic of arrays is rather underutilized in shell programming, largely because the traditional Unix shell programs (such as
sh) lacked any support for arrays. This lack of popularity is unfortunate, because arrays are widely used in other programming languages and provide a powerful tool for solving many kinds of programming problems.
Arrays and loops have a natural affinity and are often used together. The following form of loop is particularly well suited to calculating array subscripts:
for (( ...