Case statements are used in applications where multiple branches are required
Format:
Case $variable name in mode 1) command sequence 1; Mode 2) Command sequence 2; *) sequence of commands executed by default; esacCopy the code
Case statement structure features are as follows: case lines must end with the word in. Each pattern must end with a close parenthesis. Use square brackets to indicate a continuous range, such as [0-9]. Using the vertical bar "|" or symbols. The last "*)" indicates the default mode. If the preceding modes fail to match this variable, the command sequence following "*)" is executed.Copy the code