Array
An array is an ordered sequence of elements. If a collection of variables of the same type is named, the name is an array name. Each variable that makes up an array is called the component of an array, also known as an element of an array, sometimes called a subscript variable. The numeric number of each element used for the area fraction group is called the subscript. An array is a form of organizing a number of elements of the same type in an unordered form in the program design for ease of handling. These unordered collections of homogeneous data elements are called arrays.
There are two types of arrays in the shell:
- Indexed array (indexed arrays)
- Associative array (associative arrays)
Indexed array (indexed arrays)
Indexed arrays use numbers as subscripts, and subscripts start at 0 by default.
Associative array (associative arrays)
An associative array is an array that has a special indexed way. You can index it not only by integer, but also by using a string or other type of value (except null).
Array manipulation
- Get array subscript (key)
Use a For loop to iterate through an array
Linux Shell Programming (v): arrays