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
command - and get stored values through
You can store and use Bourne shell variables - with names like
, and so on - to simulate an array with elements 1, 2, and so on.
command does the trick.
As an example, if the
shell variable stores the array index
and use its value with:
eval echo "The part is \$part$n."
You need the extra quoting in that last command because
command line twice.
The really important part is
echo "The part is $part5."
The next pass gives the value of the part5 variable.
To store a line of text with multiple words into these fake array elements, the set command won't work. A usually will. For example, to read a line of text into the temp variable and store it in an "array" named part :
The first word from