标签:shell centos 单引号问题
例子一;
touch test.sh
vi test.sh
input
test=‘echo "test*"|grep [a-zA-Z0-9] |wc -c‘
echo $test
保存,退出vi;
sh test.sh
结果:echo "test*"|grep [a-zA-Z0-9] |wc -c
说明没有执行;
我们把一对单引号 修改成$();结果类容如下:
test=$(echo "test*"|grep [a-zA-Z0-9] |wc -c)
echo $test
保存,退出vi;
sh test.sh
结果:6
说明执行成功!
本文出自 “一天一点努力” 博客,请务必保留此出处http://java711.blog.51cto.com/1786533/1642028
centos下,单引号括起来的shell脚本不执行解决方法
标签:shell centos 单引号问题