A character, say $
, has a special meaning and is considered special when it has some impact other than being a literal part of data. In $x
, $
has a special meaning introducing parameter expansion.
What this passage is saying is that the backslash has its escape-character meaning only when it precedes a one of these characters with a special meaning. Ordinarily, the backslash has broader escaping meaning:
A <backslash> that is not quoted shall preserve the literal value of the following character, with the exception of a <newline>
For example, "\$x"
is the string "$x", while "a\ b"
is the string "a\ b", because the backslash in the second case precedes an unlisted character and so has no special meaning. Outside double quotes, however, a\ b
is the string "a b", with the backslash causing the space to be included literally, and the backslash itself removed.
The passage you quoted isn't saying that sometimes the characters keep their special meaning despite being escaped, but rather that the backslash has no special meaning unless it would be impacting one of them.
There is a potential dangling modifier here: are the characters considered special, or the backslash?
There are some potential cases where some of those characters inside double quotes may not have a special meaning - most obviously within embedded expansions described in the immediately-preceding points to the one you quoted, but also in the delimiter of a here-document. Embedded expansions have their own quoting rules, however, as do here-document delimiters, so it's not clear to me that it can practically arise. If it's the backslash, all it says is that a double backslash doesn't escape anything.
The best case I have for where, if it is limiting the characters, it might come up is here-document delimiters:
cat <<"A$B"
A$B
cat <<"A\$B"
A$B
Both of those do the same thing on all my shells. Arguably the $
is not special, since it was included in the delimiter the first time, and so the \
inside double quotes should not have escaped it the second time and should have been literally included. I don't think it's clear that this is required behaviour but it does seem consistent with the letter of the law.
For embedded expansions they either disavow any effect from the quotes (both kinds of $(...)
) or have both their own quoting rules and no unique way to have something be quoted (all kinds of ${...}
and ` ... `
), and I haven't managed to construct something that clearly should have a non-special version of one of those characters and a non-special backslash before it.
I suspect the bolded text is currently redundant. The potential dangling modifier at the least makes it ambiguous, and perhaps this is a phrasing bug to file for the errata or next update.
$
were to be included literally, not that the$
might retain a special meaning despite a preceding backslash. Is that what you read it as, or not?" dog \n cat"
the\n
is 2 characters, asn
is not a dollar, backquote, .... The point is that backslash normally quotes everything, but inside double quotes it only quotes the 5 listed characters.