Weather:cloudy 一、需求: a=0.5 b=3 c=a*b 求c的值:bash
[root@Dasoncheng sbin]# cat a.sh #!/bin/bash a=0.5 b=3 c=`echo $a*$b |bc` echo $c
[root@Dasoncheng sbin]# cat a.sh #!/bin/bash a=0.5 b=3 c=`echo "scale=1;$a*$b" |bc` echo $c