Get ceiling integer from number in linux (BASH)

后端 未结 13 1956
陌清茗
陌清茗 2020-12-01 04:54

How would I do something like:

ceiling(N/500)

N representing a number.

But in a linux Bash script

相关标签:
13条回答
  • 2020-12-01 05:54

    Call out to a scripting language with a ceil function. Given $NUMBER:

    python -c "from math import ceil; print ceil($NUMBER/500.0)"
    

    or

    perl -w -e "use POSIX; print ceil($NUMBER/500.0), qq{\n}"
    
    0 讨论(0)
提交回复
热议问题