【发布时间】:2013-05-15 15:13:05
【问题描述】:
这是我的脚本:
echo -n "number 1 :";
read bil1
echo -n "number 2 :";
read bil2
multiple=$(echo $bil1*$bil2 |bc -l |sed -e 's/^\./0./' -e 's/^-\./-0./');
echo " Your result : $bil1 * $bil2 = $multiple ";
如果我为$bil1 输入9.5,为$bil2 输入300,则结果为2850.0。
我想要结果:
Your result : 9.5 * 300 = 2850
如何隐藏或删除结果末尾的零? IE。只显示2850 ?
【问题讨论】:
标签: regex bash variables math logic