Search Contact information
University of Cambridge Home Department of Engineering
University of Cambridge >  Engineering Department >  computing help
next up previous contents
Next: Input/Output and Redirection Up: Shell Programming Previous: Constructions   Contents

Quoting and special characters

We've already met a number of symbols that have a special meaning to the shell. Not yet mentioned are braces ({ .. }) which are use to surround variable names when it's not clear where they end. For example, if you want to want to print the value of i with ``ed'' added on the end, you could use echo ${i}ed.

Putting the symbols in single quotes disables their special meaning. Using double quotes disables some but not others. Here are some examples using quotes. Try them and see if they work as you expect.

echo '{  *  $  $xyz  #'
echo "  *  $  $xyz  ' #  /"
Single special characters can be disabled by preceding them with a '\' character, so to print a quotemark you can use echo \"

Tim Love 2010-04-27