第 11.1 节:无限循环
bash
while true; do
echo ok
done
或者
bash
while :; do
echo ok
done
或者
bash
until false; do
echo ok
done
第 11.2 节:函数返回
bash
function positive() {
return 0
}
function negative() {
return 1
}
第 11.3 节:总会/永远不会执行的代码
bash
if true; then
echo "Always executed"
fi
if false; then
echo "Never executed"
fi