Unix C-Shell special characters and their uses

Last revision August 9, 2004

Here is a list of the characters that have special meanings to the C-shell. You should avoid using any of these in your filenames. If you need to use one of them in a filename or as part of an expression or argument to a command, quote the word containing the character within a pair of apostrophes ('), or preceed the special character with a backslash (\), in order to remove its special meaning.

Blanks or tabs are used to separate words on the command line. If you want to embed blanks in a command argument, enclose that argument in quotes.

Used to separate directory names in a file path specification; cannot be used as part of a filename.

Used to escape the special meaning of the next character so it will not be interpreted by the shell. Double it (\\) to use a real backslash character.

' "
Used in pairs to quote other special characters so they will not be interpreted by the shell, or to embed blanks. A pair of apostrophes (') protects all embedded special characters from shell interpretation, except the exclamation point (!), which can only be escaped by the backslash (\). A pair of quotation marks (") allows shell interpretation of embedded exclamation points and dollar signs (for variable substitution). A pair of one type of quote mark can be used to enclose a single instance of the other and protect it from interpretation. In general, use a pair of apostrophes when you are trying to prevent all special character interpretation, and use a pair of quotation marks when you are trying to prevent special character interpretation but still allow variable substitution (as in shell scripts).

* ? [ - ] { } ~
Used for wildcard filename expansion. The hyphen (-) has special meaning only if enclosed in square brackets.

Used to signal variable substitution, if placed at the beginning of a word, which is then taken as the variable name. Can be escaped with a backslash (\) to use a real dollar sign in a command line, except that variable substitution is always performed when a dollar sign is found inside a pair of quotation marks ("). Variable substitution never occurs inside a pair of apostrophes (').

Used for command history reference. Works even inside a pair of apostrophes (') or quotation marks ("), unless escaped with a backslash (\).

& ; ( )
Used in process control.

< > |
Used in input/output redirection.

# @
These do not have special meaning to the shell on Earth Sciences systems. On some ancient Unix systems they are used as character erase and line erase characters.

Note, however, that on some Unix systems (but not pangea) any file whose name begins with the # character is treated as a scratch file and automatically erased by the system on the day after it is created.

Comments or Questions?