Shell programming Multi-branch Case statement

Source: Internet
Author: User
Tags case statement

1. Structure

  

2. Case studies

#!/bin/bashecho "Wayne:input 1" echo "echo  : Input 2" echo "We    : Input 3" read-t 30-p "Input your choice:" Choca Se "$cho" in        "1")                echo "Wayne Love echo"                ;;        " 2 ")                echo" Echo love Wayne "                ;;        " 3 ")                echo" We love EW "                ;;        *)                echo "No no No"                ;; esac~                                                                           ~                                                                           ~                                                                                                                                                   "case2.sh" 22L, 274C

#!/bin/bashread-t 30-p "Input yes or no:" Chocase "$cho" in        "yes",                echo "Your input is yes"                ;;        " No ")                echo" Your input is no ";                ;        *)                echo "Invalid inputs"                 ;; esac~                                                                           ~                                                                           ~                                                                                                                                                    "case1.sh" 15L, 184C

  

Shell programming Multi-branch Case statement

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.