next up previous 405
Next: Using the values of variables
Up: Shell Variables
Previous: Assigning scalar values


Assigning arrays

The set command is again used but the elements are space-separated lists enclosed by parentheses. Somewhat surprisingly for a shell that mimics C, array elements start at 1, like Fortran. Here are some illustrations.

     set colours = (blue yellow green red pink)
     set label = ("Count rate" Frequency "Integration time (sec)")
     set prime = (2 3 5 7 11 13 17 19 23)
The first element of colours is "blue", the second is "yellow" and so on. Multi-word elements must be in " quotes. So the first element of label is "Count rate", and the second is "Frequency". The seventh element of prime is 17.

next up previous 405
Next: Using the values of variables
Up: Shell Variables
Previous: Assigning scalar values

C-shell Cookbook
Starlink Cookbook 4
Malcolm J. Currie
2006 November 26
E-mail:ussc@star.rl.ac.uk

Copyright © 2008 Science and Technology Facilities Council