Control flow Structure

Source: Internet
Author: User

---restore content starts---

1.if then Else statement

If condition 1

Then command 1

Elif Condition 2

Then command 2

else Command 3


If statements must be terminated with the word fi, elif and else are optional.

Simple If statement: if condition

Then command


When using the IF statement, then must be on a new line, otherwise an error is generated, and if no branch, the command delimiter must be used:

if condition; then



2.if conditions


Command 1


Command 2


3.null command

The IF statement parts cannot be empty--some statements can already do so. To solve this problem, the shell provides: null command. Empty commands are always true.

---restore content ends---

Control flow Structure

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: 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.