shell小结
(1)单分支的if语句:if 测试条件; then
选择分支
fi
表示条件测试状态返回值为0时,则执行选择分支
或者另外一种格式:
if 测试条件
then
选择分支
fi
(2)双分支的if语句:
if 测试条件; then
选择分支1
else
选择分支2
fi
两个分支仅执行其中之一。
(3)多分支的if语句:
if 条件1; then
分支1
elif 条件2; then
分支2
elif 条件3; then
分支3
...
else
分支n
fi
页:
[1]