Arithmetic in Linux Shell (Linux Shell中的数学运算)
The caculation of Integer:
1. let
i=3; j=5; let sum=i+j; let sum++; echo $sum;
2. $(())
sum=$((i+j));
3. $[]
sum=$[i+j];
4. expr
sum1=`expr i+j` sum2=$(expr $i+10)
The caculation of Float:
1. bc
result=`echo "scale=2; 2/3" | bc`; echo $result;