Escaping and Quoting

Each character in a command is interpreted by the shell.  If it is a normal character, the shell returns it to the whole of the command as a normal character.  However, it it is a special character, a metacharacter, the result of the interaction with the metacharacter will be used.  A special character like a wildcard “*” will be interpreted by the shell and expansion be performed.  Here you can see the special character “*” is expanded to all files and folders that start with “s”.

Lesson 4 / Lesson 6

shell



When you precede a character with a backslash (\), it serves as an escape character that stops the shell from interpreting the character as a special character.

'    single quotes disable recognition of all special characters
“    double quotes disable recognition of most special characters
\    escapes any special meaning to the following character

Here is a list of characters not protected by a double quote.
“    double quote
\    backslash
`    backtick (for command substitution)
$    dollar sign (for variable substitution)

 


Copyright CyberMontana Inc. and BeginLinux.com
All rights reserved. Cannot be reproduced without written permission. Box 1262 Trout Creek, MT 59874