How do you round off in bash?

How do you round off in bash?
Answer
Set the price beforehand with the environment variable PRICE=
<val>
.
</val>

  1. Then call the awk – $PRICE will go into awk as an awk variable price .
  2. It is then rounded up to the nearest 100th with +. 005.
  3. The printf formatting option %. 2f limits the scale to two decimal places.
 

Tìm kiếm

Back
Top