The Shell's Quote Characters
Four characters are used for quoting. They turn off (or "escape") special character meanings:
A backslash (
\) turns off the special meaning of the following character.Single quotes (
'…') turn off the special meaning of the characters between the quotes, except that!eventstill indicates history substitution.Double quotes ("…") turn off the special meaning of the characters between the quotes, except that
!event,$var, and`cmd`still indicate history, variable, and command substitution. (You can think of double quotes as being "weaker" than single quotes because they turn off fewer special characters.)The
lnext("literal next") character turns off the special meaning of the following character.[20] This character can be used with special characters that are otherwise interpreted as soon as they are typed. For example, in tcsh aTABtriggers filename completion; therefore, you cannot type a literalTABunless you precede it withCTRL-V.
Quoting the Quote Characters
The quote characters can be used to type literal quote characters, not simply to turn off the special meaning of other special characters.
Backslash and CTRL-V quote themselves. In other words, \\ produces \ and CTRL-V CTRL-V produces CTRL-V.
Single and double quote marks quote each other:
% echo "'" '"'
' "Backslash quotes quote marks:
% echo \' \"
' "And quote marks quote backslashes:
% echo '\' "\"
\ \The following sections describe several practical methods of using the quote characters.
[20] ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access