日期:2014-05-16  浏览次数:20683 次

shell脚本
我在一个shell脚本中写了下面两个语句:
account='cut -d ":" -f1 /etc/passwd | sort‘
echo $account
在ubuntu下执行该脚本,为啥输出的还是cut -d ":" -f1 /etc/passwd | sort,而没有执行单引号中的内嵌指令呢?

------解决方案--------------------
account=`cut -d ":" -f1 /etc/passwd | sort`

account=$(cut -d ":" -f1 /etc/passwd | sort)
后种方式更好