1. case... in... esac
The syntax of case... in... esac is as follows:Case $ variable name in"First variable content ")Program Section;;"Second variable content ")Program Section;;*)Other Program Execution segments that do not contain the first
Case ... Esac is similar to the switch ... case statement in other languages, and is a multi-branch selection structure.The case statement matches a value or a pattern, and if the match succeeds, the matching command is executed. The case statement
This article was reproduced from: http://c.biancheng.net/cpp/view/7006.htmlC Language Chinese network launched remedial classes, including "c language tutorial, C + + tutorial, algorithm/Data Structure Tutorial", all are one-to-one teaching: a
Case $ variable name in
"First variable content ")
ProgramSegment
;;
"Second variable content ")
Program Section
;
*)
Other program segments that do not contain the first variable content or the second variable content
Exit 1
;;
Case ... Esac is similar to the switch ... case statement in other languages, and is a multi-branch selection structure.The case statement matches a value or a pattern, and if the match succeeds, the matching command is executed. The case statement
Case ... Esac is similar to the switch ... case statement in other languages, and is a multi-branch selection structure.The case statement matches a value or a pattern, and if the match succeeds, the matching command is executed. The case statement
Case ... Esac is similar to the switch ... case statement in other languages, and is a multi-branch selection structure.The case statement matches a value or a pattern, and if the match succeeds, the matching command is executed. The case statement
1, the use of CASE...ESAC#!/bin/Bashecho"Please enter a number to choose a different way to display files and directories:"Echo"1-Normal display"Echo"2-Detailed display"Echo"3-Show hidden files"Echo"4-Exit"Read NUM1 Case$num 1inch 1) LS;; 2)
What does esac mean?
Some people who have just been familiar with Bash programming are always very strange about some keywords in Bash. They know its functions, but they don't know why to write them like this. For example:
#! /Bin/bash
If [!
Use case statements in Shell programming, and use case statements in shell programming
Hello everyone, today we bring you the use of Shell programming case statements!
In fact, the case statement is quite understandable. In shell programming, the if
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.