So far we have seen three types of variables: character strings, integers,
and floating-point numbers.
The fourth type of variable that the Korn shell supports
is an array.
As you may know, an array is like a list of things; you can refer
to specific elements in an array with indices, so
a[i] refers to the ith element of array
The Korn shell provides two kinds of arrays: indexed arrays, and associative arrays.
The Korn shell provides an indexed array facility that, while useful, is much more limited than analogous features in conventional programming languages. In particular, indexed arrays can be only one-dimensional (i.e., no arrays of arrays), and they are limited to 4096 elements. Indices start at 0. This implies that the maximum index value is 4095. Furthermore, they may be any arithmetic expression: ksh automatically evaluates the expression to yield the actual index.
There are three ways to assign values to elements of an array.
The first is the most intuitive: you can use the standard
shell variable assignment syntax with the array index in brackets
These assignments put the values
ed into the elements of the array
with indices 2 and 3, respectively. As with regular shell variables,
values assigned to array elements are treated as character strings
unless the assignment is preceded by let,
or the array was declared to be numeric with one of the typeset options ...