一、shell中的控制循环语句
continue break
[1]break 跳出本层(单词)循环
[2]continue 结束本次循环,继续下一次循环
eg:break
#! /bin/bash
i=1
while [ $i -lt 5 ]
do
echo "i : $i"
i=`expr $i + 1`
if [ $i -eq 3 ]
then
echo "game over!"
break;
fi
done
eg:continue
#! /bin/bash
i=1
while [ $i -lt 5 ] #1 2 3 4
do
echo "i : $i"
i=`expr $i + 1`
if [ $i -eq 3 ]
then
continue
else
echo "game start!"
fi
done