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


Special characters

The shell has a number of special characters otherwise known as metacharacters. These include wildcard characters such as *?[ ], single and double quotes, parentheses, and the \ line continuation.

If you assign a value to a variable or application parameter which includes one or more of these metacharacters, you need to switch off the special meanings. This operation is called escaping. Single characters may be escaped with a backslash. For multiple occurrences single quotes ' ' will pass the enclosed text verbatim. Double quotes " " do the same as single quotes except that $, \, and left quote ` retain their special meaning.

     setlabel label=\"Syrtis Major\" \\
     set metacharacters = '[]()/&><%$|#`@''"'
     stats europa'(200:299,~120)'
     stats europa"(200:299,~$y)"
In the first example the double quotes are part of parameter PLTITL (needed because of the embedded space) so are escaped individually. On its own \ means continue a line, but for Starlink tasks it is shorthand for the accept keyword. So we have to tell the shell to treat the backslash literally by preceding it with backslash!

In the last pair of examples an NDF section

is specified. As the last contains a variable value to be substituted, the $ retains its normal special meaning but the parentheses are escaped by surrounding the section in double quotes.



next up previous 405
Next: Prompting
Up: Shell Variables
Previous: Using the values of 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