Get ceiling integer from number in linux (BASH)
问题 How would I do something like: ceiling(N/500) N representing a number. But in a linux Bash script 回答1: 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}" 回答2: Why use external script languages? You get floor by default. To get ceil, do $ divide=8; by=3; let result=($divide+$by-1)/$by; echo $result 3 $ divide=9; by=3; let result=($divide+$by-1)/$by; echo