bash: round float number / get integer
Bash can handle getting integer from float very easily:
[root@i ~]# cat ./f_to_i.sh #!/bin/bash f=20.3 i=${f%.*} echo "float: " $f echo "integer: " $i [root@i ~]#
[root@i ~]# bash ./f_to_i.sh float: 20.3 integer: 20 [root@i ~]#