1.条件表达式:
整数 l == -eq>= -ge> -gt<= -le< -lt!= -nt2.条件语句if [ 表达式 ]thenelif[表达式]
thenelse
fi
例子:count=10if [ $count -gt 10 ]then echo "count>10"elif [ $count -lt 10 ]then echo "count<10"else echo "count=10"fi3.循环语句
while 表达式do echodone例:declare -i count=1while [ $count -lt 10 ]do echo "count="${count} #$count = 'expr $count + 1' #declare -i count=$count+1 count+=1done#-------------------------------------for 变量 in 列表
dodone
#-------------------------------------例:for i in 1 2 3 4 5do echo "i="${i}donefor i in {1..10} #>=1 and <=10
do echo "ii="${i}donefor((i=1;i<5;i++)) #两个括号
do echo "iii="${i}done