When the script to be processed in a floating-point calculation, the calculator can bc used, look at the following example
Short when it comes to calculation, this method can be used
But if you calculate more complicated, in the same command lists multiple-time
Expression would be more trouble. At this point, you can enter the bc command redirection.
Using inline input redirection:
Look at the following example
Note that the calculator created in bash variables a and b in a shell script can not be used.
var2=$(bc << EOF
scale = 4
a = ( $v1 + $v2 )
b = ($ v3 * $ v4)
a * b + 15.35
EOF
)