shell中将命令结果赋值给变量 两种方法,推荐使用后者,支持嵌套,下面两个参考链接写得很清楚了 var=`command` var=$(command) 参考: http://stackoverflow.com/questions/9449778/what-is-the-benefit-of-using-instead-of-backticks-in-shell-scripts http://book.51cto.com/art/201411/457601.htm