SunOS shell script how to preserve n decimal places

Use this method:

a=`echo $b*0.123|bc|awk '{printf("%.2f,$1")}`

The following methods will not work:

echo "scale=2;$b*0.123"|bc

Guess you like

Origin blog.csdn.net/qq_35902025/article/details/130393602