作用
将一个命令的输出(output)替换为命令本身
一般形式
$(command)或`command`
注意点
- bash在subshell中执行command然后替换
- 执行command产生的输出中的newline(“\n”)将被删除
- 可嵌套,若用反引号嵌套,内层反引号用“\”转义
例子
“$(echo ls)”替换为“ls”
“`echo ls`”替换为“ls”
待完善
(?不知道怎么理解?)
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. If the substitution appears within double quotes, word splitting and filename expansion are not performed on the results.
网友评论