Javatpoint Logo
Javatpoint Logo

Shell Scripting case

A case construct helps us to simplify nested if statement. You can match several variables against one variable. Each case is an expression matching a certain pattern.


Linux Shell Scripting Case 1

Look at the above snapshot, you can write one pattern or more than one pattern together according to the situation. Let's see an example to understand it more clearly.


Linux Shell Scripting Case 2

Look at the above snapshot, we have shown a script to show the capital of different states. States Punjab and Haryana are written together as they share same capital.


Linux Shell Scripting Case 3

Look at the above snapshot, user can enter a state name and script will display its capital respectively.

Next TopicScripting eval

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA