next up previous 405
Next: Assigning arrays
Up: Shell Variables
Previous: Shell Variables


Assigning scalar values

You assign a value to a variable using the set command.

     set colour = blue
     set title = "Chiaroscuro 1997"
     set caption = "The most distant quasar observed is at redshift "
     set flux_100 = 1.2345E-09
     set n = 42
     set _90 = -1
The first four examples assign strings, and the last two assign integer values. Yes the value of flux_100 is not a real number. Multi-word strings should be enclosed in " quotes. The spaces around the equals sign are necessary.

You can also remove variables with the unset command. This accepts *?[ ] wildcards to match the names of the shell variables.

     unset colour
     unset iso_*             # iso_ followed by zero or more characters
     unset flux_1??          # flux_1 followed by any pair of characters
     unset [nx-z][0-9]*      # One of n, x, y, or z then an integer followed
                             # by zero or more characters



next up previous 405
Next: Assigning arrays
Up: Shell Variables
Previous: Shell Variables

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

Copyright © 2009 Science and Technology Facilities Council