#bash 没有小数,也没有 sqrt 函数;bc 有 sqrt()
number=100
result=$(bc <<< "sqrt($number)")
#result is 10
#scale 设置小数点后的位数
result2=$(bc <<< "scale=5; sqrt(2)")
#result2 is 1.41421
#awk 也有 sqrt()
fromAwk=$(awk -v x=2 'BEGIN { print sqrt(x) }')
#fromAwk is 1.41421
echo "result is $result"
echo "result2 is $result2"
echo "fromAwk is $fromAwk"