shell中的break和exit的区别
1个回答
展开全部
bash shell script (bash脚本)中,break是退出一层循环,break 2是退出2层循环(当有相互嵌套时),....
break: break [n]
Exit for, while, or until loops.
Exit a FOR, WHILE or UNTIL loop. If N is specified, break N enclosing
loops.
Exit Status:
The exit status is 0 unless N is not greater than or equal to 1.
脚本中的exit的作用是整个脚本退出了,逻辑上exit之后的命令不再运行。
break: break [n]
Exit for, while, or until loops.
Exit a FOR, WHILE or UNTIL loop. If N is specified, break N enclosing
loops.
Exit Status:
The exit status is 0 unless N is not greater than or equal to 1.
脚本中的exit的作用是整个脚本退出了,逻辑上exit之后的命令不再运行。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询