(Linux case Command), case command in Linux is also known as case…esac statement that allows users to execute commands based on some specified pattern. It’s the best alternative option for multiple if/elif on a single variable.
Means, if you are using if…elif statement for multiple times, it can be replaced by case statement by just a single time.
Syntax of case command in Linux
case Word in [PATTERN...) COMMANDS ;;]... esac
In the Linux case command syntax, the string word is actually compared against every specified pattern until the right match is found. Users can specify a number of pattern, while the minimum number of pattern is one. While the command ;; is similar to break command in C programming language, and indicates that the program flow should jump to end.
Options available for Linux case Command
- help case: Displays help information
Examples of Linux case command

Nishant Verma is a senior web developer who love to share his knowledge about Linux, SysAdmin, and more other web handlers. Currently, he loves to write as content contributor for ServoNode.