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
图中红色高亮是比较容易接受的!我尽可能多的使用这两者!哈哈
时间: 2024-11-13 09:07:04