while [condition]
do
for [condition]
do
if [ "$x" > 3 ];then
break
fi
done
if [ "$x" > 3 ];then
continue
fi
done
在上面的脚本中,我必须两次测试
"$x" > 3
。实际上,第一次测试时,如果为真,我想跳出while循环并继续下一个while循环。有没有更简单的方法,可以使用类似
continue 2
的语句来跳出外层循环?
continue 2
? - P.Pcontinue n
。你确定for [condition]
...通常是for n in a b c
或类似的形式。祝好运。 - shellter