LMLPHP后院

shell 条件语句 if then

先来看语法。

if statement

if command
then
  commands
fi

连写语法:

if command; then
  commands
fi

if else statement

if command
then
  commands
else
  commands
fi

if elif statement

if command_1
then
  commands

elif command_2
then
  commands

elif command_3
then
  commands

# ...

fi

条件语句中 command 执行成功,则会执行 then 中的 commands。

2024-03-28 18:42:10 1711622530 0.010134