bash的内联命令 [英] bash for inline command
本文介绍了bash的内联命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要运行的命令,在bash脚本,而这个bash脚本中我要运行其他命令。我运行CentOS的。
I have to run commands, in a bash script, and within this bash script I have to run other commands. I am running CentOS.
我发现2种方法来做到这一点在博客和手册:
I found 2 ways to do this on blogs and manuals:
1)用蜱或重音字符
command `sub command`
或
2)使用美元符号和括号
2) using the dollar sign and parentheses
command $(sub command)
有什么2和其中一个之间的差被preferable使用?
What is the difference between the 2 and which one is preferable to use?
推荐答案
有除了在nestability没有什么区别:
There's no difference except in "nestability":
的 $()
是可嵌套的:
$ echo $(echo "hi" $(echo "there"))
而``是没有的。
while the `` is not.
这篇关于bash的内联命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文