来自“初学者指南”:
3.4.5. Command substitution
Command substitution allows the output of a command to replace the command itself. Command substitution
occurs when a command is enclosed like this:
$(command)
or like this using backticks:
\`command`
Bash performs the expansion by executing COMMAND and replacing the command substitution with the
standard output of the command, with any trailing newlines deleted. Embedded newlines are not deleted, but
they may be removed during word splitting.
franky ~> echo `date`
Thu Feb 6 10:06:20 CET 2003
When the old−style backquoted form of substitution is used, backslash retains its literal meaning except when
followed by "$", "`", or "\".
The first backticks 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.在这段话中,有一句我不明白。
The first backticks not preceded by a backslash terminates the command substitution.你能提供更详细的例子来解释吗?非常感谢!
发布于 2015-07-28 07:33:38
作者指的是第一个没有逃脱的回击。
虚构的例子:
echo `command \` arg`首先,命令和arg之间的反勾号用反斜杠转义,所以替换被最后一个反勾号关闭。
https://stackoverflow.com/questions/31669425
复制相似问题