- bc <<< “计算表达式”
num1=3.4
num2=4.3
num1_2=$(bc <<< "$num1+$num2")
echo "num1_2 is $num1_2"
2.echo “计算表达式” | bc
num1=3.4
num2=4.3
num1_2=$(echo "$num1+$num2" | bc)
echo "num1_2 is $num1_2"
num1=3.4
num2=4.3
num1_2=$(bc <<< "$num1+$num2")
echo "num1_2 is $num1_2"
2.echo “计算表达式” | bc
num1=3.4
num2=4.3
num1_2=$(echo "$num1+$num2" | bc)
echo "num1_2 is $num1_2"