Bash Cases Statement
The case construct in bash shell allows us to test strings against patterns that can contain wild card characters. Bash case statement is the simplest form of the bash if else then condition statement.
The simple example for this is if you are expecting different inputs from a user and want to execute specific command sets on the choice used.
case $variable in
pattern1 )
statements ;;
pattern2 )
statements ;;
* ) statements ;;
…
esac
We can see the common use of the case statement in the init scripts of the services which has the options like start, stop, restart and status.
7 Comments
Awesome post! Keep up the great work! 🙂
February 1, 2020
Great content! Super high-quality! Keep it up! 🙂
February 16, 2020
Thanks intended for supplying these kinds of awesome subject matter.
March 28, 2020
You’ve gotten very well info these.
April 26, 2020
This is very interesting, You are a very skilled blogger. I have joined your rss feed and look forward to seeking more of your fantastic post. Also, I have shared your web site in my social networks!
June 1, 2020
I’m not sure why but this site is loading incredibly slow for me. Is anyone else having this problem or is it a issue on my end? I’ll check back later on and see if the problem still exists.
June 2, 2020
Magnificent goods from you, man. I’ve understand your stuff previous to and you are just too excellent. I actually like what you’ve acquired here, certainly like what you are stating and the way in which you say it. You make it entertaining and you still take care of to keep it sensible. I cant wait to read far more from you. This is really a terrific site.
June 3, 2020