How to display number to two decimal places in bash function

前端 未结 4 1537
南方客
南方客 2021-02-20 16:27

How should I take a number that is in hundreths of seconds and display it in seconds to two decimal places? Psuedo code to follow the dTime function I am not sure about but you\

4条回答
  •  有刺的猬
    2021-02-20 16:42

    Below can be done for 2 decimal precision ,

    echo $T | bc -l | xargs printf "%.2f"
    

提交回复
热议问题