Shell Script (iii)

Source: Internet
Author: User
Tags case statement
One? Using the FOR Loop statement

(1) Structure of the FOR statement: When using a For loop statement, you need to specify a list of possible values for a variable, repeating the same sequence of commands for each different value until the value of the variable is used up to the exit loop. (For tasks that need to be executed more than once, and each execution is just a different object, the other commands are the same.) )
For variable name in value list
Do
Command sequence
Done

II. Using the WHILE Loop statement

(1) While syntax structure: when using a while statement, you can repeatedly execute a sequence of commands based on a specific condition until the condition is no longer satisfied. (For cases where the number of cycles is required, the operand is numbered numerically and is repeated on a specific condition)
While condition test action
Do
Command sequence
Done

Iii. using the Case Branch statement

(1) The structure of the case Branch statement: very similar to the structure of a multi-branch if statement, except that the IF statement needs to judge many different conditions, whereas the case statement only determines the different values of a variable. (for multiple values for a variable, you need to execute a different command sequence for each of these values)

Shell Script (iii)

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.