I have a number in a bash variable n, and want to round it to 2 decimal places. How can I do that?
n=0.0867268
Need to have
num=0.09
I have a number in a bash variable n, and want to round it to 2 decimal places. How can I do that?
n=0.0867268
Need to have
num=0.09
Try:
printf -v num "%0.2f" $n