Shell script selection structure (1)

Source: Internet
Author: User
Tags case statement

Bash selection Structure
Select the program structure to determine the given conditions, determine certain conditions based on the judgment results, and control the program process based on the judgment results. (For details about how to use the structure selected in shell scripts, refer to the help Documentation)

If statement Structure
(1) If judgment condition; then
Command
Fi

650) This. width = 650; "Title =" qqpinyin unnamed .png "src =" http://s3.51cto.com/wyfs02/M00/43/CB/wKioL1Pcr_ijS5cMAADIq7QkKWY808.jpg "alt =" wkiol1pcr_ijs5cmaadiq7qkwy808.jpg "/>


(2) If judgment condition; then
Command
Else
Command

Fi

650) This. width = 650; "Title =" qqpinyin unnamed .png "src =" http://s3.51cto.com/wyfs02/M01/43/CB/wKioL1PcreDjAO2BAAEwnTAaKLE772.jpg "alt =" wkiol1pcredjao2baaewntaakle772.jpg "/>
(3) If judgment conditions; then
Command
Elif judgment condition; then
Command
...
Else
Command
Fi

Use and nesting of multiple branches of IF Statements

650) This. width = 650; "Title =" qqpinyin unnamed .png "src =" http://s3.51cto.com/wyfs02/M02/43/CB/wKioL1Pcth3SfbCkAAJBJJThmmA382.jpg "alt =" wkiol1pcth3sfbckaajbjjthmma382.jpg "/>


Case statement
Case variable in
Pattern1) command ;;
...
*) Command ;;
ESCA

Simple use of case and nested with IF Statements

650) This. width = 650; "Title =" qqpinyin unnamed .png "src =" http://s3.51cto.com/wyfs02/M01/43/CB/wKiom1PcwAnSi5uLAAHa9ffAeg8290.jpg "alt =" wkiom1pcwansi5ulaaha9ffaeg8290.jpg "/>

This article from the "rookie road forward" blog, please be sure to keep this source http://8381039.blog.51cto.com/8371039/1534250

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.