How to multiple decimals in Linux?
When I do it like this i get an error message
echo "$((1 * 1.1))"
-bash: 1 * 1.1: syntax error in expression (error token is ".1")
How to multiple decimals in Linux?
When I do it like this i get an error message
echo "$((1 * 1.1))"
-bash: 1 * 1.1: syntax error in expression (error token is ".1")
The bash shell does not support floating point numbers, but you can use the bc tool like this:
$echo '2 * 3.5' | bc
7.0
$
bc doesn't like variables another way
a=2
b=3.5
echo "$a * $b" | bc
7.0
you can do like this also
awk 'BEGIN{print .9*.9}'