Shell break statement memo

Source: Internet
Author: User
Tags exit in
  1. Shell commands: Common commands and built-in commands.
  2. External commands: commands that can be executed at the command prompt.
  3. Built-in commands: Implemented in shell, cannot be called as an external program.
  4. The internal or external commands are generally not of much importance, but internal commands are more efficient to execute.
  5. Common commands used in shell programming:
  6. 1,
    Break


    Command
  7. Use this command
    For


    /
    While


    Exit in the/Until loop. You can also add numeric parameters to indicate the number of layers that exit the loop (
    Break


    2) Exit A loop without adding parameters.
  8. Example:
     
  9. #! /Bin/sh

     
  10. # This is a example for the instruction of "break"


  11. Var1 = 1
  12. Var2 = 1
  13. While


    [Var1-le 10]
  14. Do



  15. While


    [Var2-le 10]

  16. Do


  17. Echo
    "Var1 =1 {var1} var2 =$ {var2 }"

  18. Var1 = ($ var2 + 1 ))

  19. If


    [Var2-EQ 8]; then

  20. Break


    2
  21. Fi
  22. Done
  23. Var2 = ($ var1 + 1 ))
  24. Done
  25. Exit 0
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.