|
- bash# x=a
- bash# echo `echo \$x`
- a
复制代码
How does that happen? I found there's a passage in bash manual describing command substitution.
When the old-style backquote form of substitution is used, backslash retains its literal meaning except when followed by $, `, or \. The first backquote not preceded by a backslash terminates the command substitution. When using the $(command) form, all characters between the parentheses make up the command; none are treated specially.
So it means when backslash followed by $, it is supposed to escape next character, but it seems different from my test.
I'm fuzzy on the usage of backslash in backquote. |
|