[dywang@dywmac zzz]$ sum=1+2+3 [dywang@dywmac zzz]$ echo $sum 1+2+3
[dywang@dywmac zzz]$ declare -i sum=1+2+3 [dywang@dywmac zzz]$ echo $sum 6
$
取出計算結果存到變數 sum。
[dywang@dywmac zzz]$ unset sum [dywang@dywmac zzz]$ sum=$((1+2+3+4)) [dywang@dywmac zzz]$ echo $sum 10