标签:
break是跳出当前循环,而continue是跳出当次循环,而重新开始新循环
[root@Director test]# cat demo.sh #/bin/bash while true;do read -p "Please input two number: " x y if ((x>9));then continue elif ((y>9));then break else z=$((x+y)) echo $z fi done echo "Execution completed!"
[root@Director test]# sh demo.sh Please input two number: 1 2 3 Please input two number: 10 2 #$x>9时,当次循环后面部分不在执行,而重新开始一次循环 Please input two number: 2 10 #$y>9时,跳出整个循环体 Execution completed!
shell脚本学习总结--break和continue的区别
标签:
原文地址:http://www.cnblogs.com/zydev/p/5746824.html