#!/bin/bash # How to do floating point in Bash # Using the JDoodle platform # echo "welcome to JDoodle.com" awk 'BEGIN {printf "%.3f\n", 2024.50 / 3}' n1=5 n2=10 echo | awk -v x=$n1 -v y=$n2 'BEGIN {printf "%.3f\n", 2024.50 / 3 + x + y}' echo "bye to JDoodle.com" # A trick question as Bash only does integers. # However, dropping down to Awk is the answer as Awk does floating point.