我的剧本
echo -n "number 1 : ";
read bil1
echo -n "number 2 :";
read bil2
jlh=$(echo $bil1 + $bil2 |bc -l |sed -e 's/^\./0./' -e 's/^-\./-0' -e 's/\.0*$//');
printf "Your result : %d + %d = %'d\n" $bil1 $bil2 $jlh
如果我在 $bil1 中输入“0.1”,在 $bil2 中输入“0.4”,结果是
line 24: printf: 0.1: invalid number
line 24: printf: 0.4: invalid number
line 24: printf: 0.5: invalid number
Your result : 0 + 0 = 0
我想 :
Your result : 0.1 + 0.4 = 0.5
如何在我的 bash 中显示该结果?