number calculation in bash
computation efficiency rank:(()) == let > expr > bc
1.(()) and let is bash buildin command, which can execute efficiently
2.expr and bc is system command, drain memory and low efficiency.
3.(()) let and expr can only do integer computation.
4.bc can do float computation.
(())
1 | |
let
1 | |
expr
1 | |
bc
1 | |
number calculation in bash
https://rug.al/2013/2013-08-03-number-calculation-in-bash/