#!/bin/bash
read expression
printf "%.3f\n" $(echo "scale=10;$expression" | bc -l)
input:
23 + 12*(34 - 45) + 67/3
output:
-86.667
#!/bin/bash
read expression
printf "%.3f\n" $(echo "scale=10;$expression" | bc -l)
input:
23 + 12*(34 - 45) + 67/3
output:
-86.667