January 2001
Intermediate to advanced
480 pages
7h 22m
English
One-dimensional arrays are supported by the Korn shell. Arrays can have a maximum of 4096 elements. Array subscripts start at 0 and go up to 4096 (or the maximum element minus one). Any variable can become a one-dimensional array by simply referring to it with a subscript. Here, variable X is set to A:
$ X=A
By explicitly assigning X[1] a value, variable X is transformed into an array variable:
$ X[1]=B
The original assignment to variable X is not lost. The first array element (X[0]) is still assigned A.
| ${variable//pattern1/pattern2} | replace all occurrences of pattern1 with pattern2 in variable |
| ${variable/pattern1/pattern2} | replace first occurrence of pattern1 with pattern2 in ... |
Read now
Unlock full access