Shell Programming Basics Break, Continue practice

Source: Internet
Author: User

First, the grammar

Break: Used to jump out of a loop. Break N can jump out of a multilayer loop

Break
Break N

Continue: Used to skip loops. Continue N can skip multi-layer loops

Continue
Continue N
Ii. details and differences
  1. Break
     forVar1inch 1 2 3 Do   forVar2inch 0 5   Do    if["$var 1"-eq"2"-A"$var 2"-eq"0"]; Then Break2    Else      Echo "$var 1 $var 2"    fi   Done Done
    [Email protected]:~$./test. SH 1 0 1 5
  2. Continue
     forVar1inch 1 2 3 Do   forVar2inch 0 5   Do    if["$var 1"-eq"2"-A"$var 2"-eq"0"]; ThenContinue2    Else      Echo "$var 1 $var 2"    fi   Done Done
    [Email protected]:~$./test. SH 1 0 1 5 3 0 3 5

Shell Programming Basics Break, Continue practice

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.