In the first part of my question I will provide some background info as a service to the community. The second part contains the actual question.
Part I
Assume I've created the following alias:
alias ls='ls -r'
I know how to temporarily unalias (i.e., override this alias) in the following ways, using:
1) the full pathname of the command: /bin/ls
2) command substitution: $(which ls)
3) the command builtin: command ls
4) double quotation marks: "ls"
5) single quotation marks: 'ls'
6) a backslash character: \ls
Case 1 is obvious and case 2 is simply a variation. The command builtin in case 3 was designed to ignore shell functions, but apparently it also works for circumventing aliases. Finally, cases 4 and 5 are consistent with both the POSIX standard (2.3.1):
"a resulting word that is identified to be the command name word of a simple command shall be examined to determine whether it is an unquoted, valid alias name."
and the Bash Reference Manual (6.6):
"The first word of each simple command, if unquoted, is checked to see if it has an alias."
Part II
Here's the question: why is case 6 (overriding the alias by saying \ls
)
considered quoting the word? In keeping with the style of this question, I am looking for references to the "official" documentation.
The documentation says that a backslash only escapes the following character, as opposed to single and double quotation marks, which quote a sequence of characters. POSIX standard (2.2.1):
"A backslash that is not quoted shall preserve the literal value of the following character, with the exception of a < newline >"
Bash Reference Manual (3.1.2.1):
"A non-quoted backslash ‘\’ is the Bash escape character. It preserves the literal value of the next character that follows, with the exception of newline."
(BTW, isn't "the next character that follows" a bit of overkill?)
A possible answer might be that this situation isn't that special: it is
similar to a few cases in ANSI-C quoting, e.g. \nnn
. However, that is still
escaping a single character (the eight-bit character whose value is the octal
value nnn), not a sequence of characters.