bash环境下处理float,主要是通过bc命令来完成的,在shell脚本中也可以这样来处理浮点数。
bc - Arbitrary precision calculator language
参数说明:更多详细的信息可以参考man bc页面
[root@rhel6164 ~]# bc -h
usage: bc [options] [file ...]
-h --help print this usage and exit
-i --interactive force interactive mode
-l --mathlib use the predefined math routines
-q --quiet don't print initial banner
-s --standard non-standard bc constructs are errors
-w --warn warn about non-standard bc constructs
-v --version print version information and exit
例子:
$v