|
|
You can extract specific elements from a list by putting one or more element numbers after the variable name in brackets. Using the example in ``Variable substitutions'':
$editors(2)will have the value:
xedit
More than one subscript can be given. For example, the following:
days=(mon tue wed thur fri sat sun) echo $days(3 1 3)will produce:
wed mon wed
Subscripts that are out of range are ignored, so the same result is obtained with:
echo $days(3 0 1 8 3)
The element numbers may come from another variable or any other construct, so:
$days($#days)is permitted and has the value
sun