shell 加法
i=$i+1
是在i的变量值后加上字符串'+1'
总结:其他语言中的$i++操作在shell中表示如下:
#!/bin/bash
n=1;echo -n "$n "
let "n = $n + 1"
echo -n "$n "
: $((n = $n + 1))
echo -n "$n "
(( n = n +1 ))
echo -n "$n "
: $[ n = $n +1 ]
echo -n "$n "
n=$[ $n + 1 ]
echo -n "$n "
let "n++"
echo -n "$n "
(( n++ ))
echo -n "$n "
: $[ n++ ]
echo -n "$n "
echo
运行结果:1 2 3 4 5 6 7 8 9