If 语法
if [ condition ] then commands fi
if then else
if [ condition ] then commands else commands fi
if then elseif
if [ condition ] then commands1 elif then commands2 ...... else commandsx fi
条件符号使用双圆括号,可以在条件中植入数学表达式
双方括号,可以在条件中使用通配符
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
for 循环语句
for var in value1 value2 ...... do commands done
C式命令
for ((变量;条件;自增减运算)) do 代码块 done
控制循环:
sleep N
continue :本次循环到此为止,可以开始下一次循环
break:跳出循环
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
while 循环 ---不知道循环多少次,建议用while
while [ condition ] do commands done
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
case多条件分支语句
标签:do,commands,Shell,else,循环,done,随笔,condition From: https://www.cnblogs.com/jjjyyylll/p/18404237