shell 脚本
控制语句
1.if
if condition
statements
then
statements
elif
statements
fi
2.for
for variable in values
do
statements
done
3.while
while conditoin
do
statements
done
4.until
until condition
do
statements
done
5.case
case variable in
pattern | pattern | pattern……) statements
pattern | pattern | pattern……) statements
……
esac
6.and
statements && statements && statements ……
从左开始执行命令,如果执行结果为true则继续执行,为false则返回
7.or
statements || statements || statements ……
从左开始执行命令,如果执行结果为false则继续执行,为true则返回