break , continue , exit

例一:
#!/bin/bash
. /etc/init.d/functions
for i in `seq `;do
if [ $i -eq ];then
#continue #没有数字3
break
#exit
fi
echo $i
done
echo "ok~" 例二:
#!/bin/bash
for((i=0;i<=5;i++));do
if [ $i -eq 3 ];then
        #continue
        #break
        exit
fi
    echo $i
done
 
break   n     :n表示跳出循环的层数,如果省略n表示跳出整个循环。
continue   n  :n表示退到第n层循环,如果省略n,表示跳过本次循环,忽略本次循环的剩余代码,进入下一次循环。
exit   n      : 退出当前shell的程序,并返回n。n也可以省略。
 
 

break , continue , exit的更多相关文章

  1. [转帖]Shell脚本中的break continue exit return

    Shell脚本中的break continue exit return 转自:http://www.cnblogs.com/guosj/p/4571239.html break结束并退出循环 cont ...

  2. break continue exit return 的区别

    [root@localhost day1]# cat ss.sh #!/bin/bash for ((i=0;i<5;i++)) do if [ $i -eq 3 ] then break #c ...

  3. Shell脚本中的break continue exit return

    转自:http://www.cnblogs.com/guosj/p/4571239.html break结束并退出循环 continue在循环中不执行continue下面的代码,转而进入下一轮循环 e ...

  4. python中break continue exit() pass区别

    1.break break是终止本次循环,比如你很多个while循环,你在其中一个while循环里写了一个break,满足条件,只会终止这个while里面的循环,程序会跳到上一层while循环继续往下 ...

  5. 特殊的流程控制语句break continue exit

    break语句可以结束当前的for.foreach.while.do-while.或者switch的执行. for($i=1; $i<10; $i++) { if($i == 5) { echo ...

  6. C语言break/continue/exit/return的功能区别

    break是跳出整个循环而执行循环体之外的下一条语句: continue只是跳出本次循环继续判断下一次循环条件是否满足. exit() 结束当前进程/当前程式/,在整个程式中,只要调用 exit ,就 ...

  7. (转)Shell脚本之break,continue,和exit区别

    Linux脚本中的break continue exit return break结束并退出循环 continue在循环中不执行continue下面的代码,转而进入下一轮循环 exit退出脚本,常带一 ...

  8. delphi中exit,abort,break,continue 的区别

    from:http://www.cnblogs.com/taofengli288/archive/2011/09/05/2167553.html delphi中表示跳出的有break,continue ...

  9. delphi中break,continue, exit,abort, halt, runerror的异同

    delphi中表示跳出的有break,continue, exit,abort, halt, runerror. 1.break 强制退出循环(只能放在循环中),用于从For语句,while语句或re ...

随机推荐

  1. winform学习之-----页面设计-20160523

    1.将默认的Form属性设置为FormBorderStyle:none 2.picturebox均设置为backgroundImage 3.lable设置自动换行,autosize true,设置Ma ...

  2. mac 下的 top 命令

    mac 下的 top 命令 文章目录 以前只是在 linux 机器上使用 top 命令.常用的快键键是: p 键 - 按 cpu 使用率排序 m 键 - 按内存使用量排序 这 2 个快捷键在 mac ...

  3. FLTK 1.3.3 MinGW 4.9.1 Configuration 配置

    Download FLTK 1.3.3 Download CMake 3.2.0 Start CMake 3.2.0, fill the source and destination: source: ...

  4. MIB-II

    . 1.3.6.1.2.1

  5. web app

    *********Modernizr作为开发HTML5必要的js工具************ Modernizr作为开发HTML5必要的js工具 *********字体大小设 rem********* ...

  6. ASP中可能出现的一种包含漏洞(Server.execute)

    author: bin <% Server.execute(request(“file”)) %> 与include的区别,它可以动态包含文件. 被包含文件里面可执行ASP代码,在国外的源 ...

  7. bootstrap-table 原来bootstrap还有这么强大的表格插件

    http://issues.wenzhixin.net.cn/bootstrap-table/index.html

  8. C# - 杨涛分页控件AspNetPager

    http://www.webdiyer.com/downloads/ 前台 <%@ Page Language="C#" AutoEventWireup="true ...

  9. 离线更新SEPM服务器的病毒定义库

    1. 从http://www.symantec.com/security_response/definitions/download/detail.jsp?gid=sep下载JDB文件    2. 将 ...

  10. PowerShell - Read an Excel file using COM Interface

    http://www.lazywinadmin.com/2014/03/powershell-read-excel-file-using-com.html