May 2000
Beginner
761 pages
18h 20m
English
In the TC shell, an array is simply a list of words, separated by spaces or tabs, and enclosed in parentheses. The elements of the array are numbered by subscripts starting at one. If there is not an array element for a subscript, the message "Subscript out of range" is displayed. Command substitution will also create an array. If the $# notation precedes an array name, the number of elements in the array is displayed.
1 > set fruit = ( apples pears peaches plums ) 2 > echo $fruit apples pears peaches plums 3 > echo $fruit[1] Subscripts start at 1 apples 4 > echo $fruit[2–4] Prints the 2nd, 3rd, and 4th elements pears peaches plums 5 > echo $fruit[6] Subscript out of range. 6 > echo ... |
Read now
Unlock full access