Self-study Linux shell12.6-nested loops for command

Source: Internet
Author: User

Click Back to learn the path of the Linux command line and shell script

12.6-Nested loop for command
  • A nested loop is a loop in which there is one loop.
  • The inner loop, in the outer loop body, triggers an internal loop during each execution of the outer loop until the inner loop executes.
  • How many times the outer loop executes, and how many times the inner loop is completed. Of course, the break statement for either an external loop or an inner loop interrupts the process.

Example 1:

The above program when i=1,2,3 traversal, J's Traversal

Example 2:

Example 3: Placing a For loop in the while

Example 4:until and while binding








Self-study Linux shell12.6-nested loops for command

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.