tcsh provides one-dimensional array variables. Any variable may be used as an array; the set builtin will explicitly declare an array.
An array is created automatically if any variable is assigned to using the syntax
set name[subscript]=word ...
The subscript is treated as an arithmetic expression that must evaluate to a number greater than or equal to zero.
The tcsh shell also provides the following syntax:
@ Print the values of all shell variables. @ name = expr Assign the value of expr to name. @ name[index] = expr Assign the value of expr to the index'th component of name both name and its index'th component must already exist. @ name++|-- Increment (`++') or decrement (`--') name @ name[index]++|-- Increment (`++') or decrement (`--') its index'th component.
expr may contain the operators `*', `+', etc., as in C. If expr contains `<', `>', `&' or `' then at least that part of expr must be placed within `()'.
The space between `@' and name is required.
The spaces between name and `=' and between `=' and expr are optional.
Components of expr must be separated by spaces.
Referencing an array variable without a subscript is equivalent to referencing element zero.
The unset builtin is used to destroy arrays:
unset name[subscript] destroys the array element at index subscript.
unset name, where name is an array, removes the entire array.
set - Set a shell variable = value
unset - Remove variable or function names