CHINA PHP CODER

CHINA PHP CODER

Who am I?

I am a china php coder.


What I write about


Recent Posts

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 '

运行结果:1 2 3 4 5 6 7 8 9