linux shell中数值变量的递增
001、使用let
[root@PC1 test2]# ls [root@PC1 test2]# a=10 [root@PC1 test2]# echo $a 10 [root@PC1 test2]# let a=$a+5 ## 使用let对数值变量进行修改 [root@PC1 test2]# echo $a 15

002、使用(())
[root@PC1 test2]# ls [root@PC1 test2]# a=100 [root@PC1 test2]# echo $a 100 [root@PC1 test2]# a=$((a+30)) ## 使用(())对数值变量进行修改 [root@PC1 test2]# echo $a 130

。

浙公网安备 33010602011771号