linux下各种形式的shell加法操作总结

linux 下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
posted @ 2013-09-17 10:40  蒋蒋  阅读(8975)  评论(0编辑  收藏  举报