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

小白谢了个小脚本,可是不符合预期,望指点
小白谢了测试小脚本,目的是进行乘法计算
[xuhao@/export/home/xuhao]cat ~/xuhao_test/test1
#!/usr/bin/bash
prepaid=100
ss=$prepaid*10|bc
echo $ss
[xuhao@/export/home/xuhao]
下面是执行结果。。。。郁闷
[xuhao@/export/home/xuhao]sh ~/xuhao_test/test1

[xuhao@/export/home/xuhao]

------解决方案--------------------
prepaid=100
ss=`echo $prepaid*10 
------解决方案--------------------
bc`
echo $ss

------解决方案--------------------
上面的都是正解,还可以用 let 和 expr 来做