一.if语句
if [expression]
then
elif[expression]
then
else
fi
注 : expression前后要有空格;判断相等用 = 而不是 == ;
then可以另起一行,也可以与if同行,同行时要加‘;‘;
二.case模式
case值 in
模式1)
command1
command2
command3
;;
模式2)
command1
command2
command3
;;
*)
command1
command2
command3
;;
esac
例 :
case $value in
value1)
command
;;
value2)
command
;;
esac
三.for循环
for 变量 in 列表
do
command1
command2
...
commandN
done
四.while循环
while [ command ]
do
Statement(s) to be executed if command is true
done
五.util循环
until command
do
Statement(s) to be executed until command is true
done
时间: 2024-10-04 11:33:11