Bash returns value 4
instead of 4.2
when dividing 21/5
. And returns 36
when doing 9 * (21/5)
instead of 37.8
.
echo "$(( 21/5 ))"
4
echo "21/5" | bc
4
Similarly 9 * ( 21/5 )
returns 36
but it should be 37.8
;
y = 9;
num_lines = 21;
w = 5;
let value="$y * ($num_lines/$w)"
echo $value
36