我正在尝试循环控制。 while循环然后是for循环,在其中有几个if循环,如果if循环中的3满足它应该退出for循环继续while循环否则它应该退出if循环以继续其余循环迭代
LIMIT=100
while [ "count" -le "$LIMIT" ]
do
for i in 1 2 3 4 5
do
var a
var b
var c
var d
if [ $d -eq 1 ] && [ $a == Done ] && [ $b -eq 0 ]
then
echo "$c" | tr '\n' '\t'
echo "Successful"
break 2 # Need to exit entire for loop
elif [ $d -eq 0 ] && [ $a == Done ] && [ $b -eq 0 ]
then
break # Need to go to next iteration of for
elif [ $a == Active ]
then
echo "Active" # Need to exit entire for loop
break 2
elif [ $d -eq 1 ] && [ $a == Done ] && [ $b -gt 0 ]
then
echo "Fail" # Need to exit entire for loop
break 2
elif [ $a == Queued ]
then
echo "Queued" # Need to exit entire for loop
break 2
else
echo "Nothing"
fi
done
done
出于某种原因,如果循环为真,它会先退出所有内容。
答案 0 :(得分:0)
知道了,实际上我正在使用break 2退出,因为好像已经退出所以使用单个break会让我完全退出循环,并继续下一次迭代任何if循环需要继续使用。
所以代码应该是
<g:select>