In bash,I am trying to do math with a integer and a float number to get a integer result. below code snippet doesn't work:
x=25
y=0.2
z=$((x*y))
echo $x*$y=$z
The error message is:
sh: line 3: 0.2: syntax error: invalid arithmetic operator (error token is ".2")
If both variable is integer, it works fine.
How can I get "25*0.2=5" from bash script?
bashdoesn't support floating point arithmetic. Usebcorawkorperl