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.

(())

value=$((3*(5+2)))
((value++))

let

let "value=3*(5+2)"
let value++

expr

value=`expr 3 \* \( 5 + 2\)`
value=`expr $value+1`

bc

value=`echo "3*(5+2)" | bc`
value=`echo "$value+1" | bc `


Published

03 August 2013

Category

operation

Tags