Open In App

case command in Linux with examples

Last Updated : 15 May, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

case command in Linux is the best alternative when we had to use multiple if/elif on a single variable. It is used to execute the commands based on the pattern matching.

Syntax:

case WORD in [PATTERN [| PATTERN]...) COMMANDS ;;]... esac

Example:

Options:

  • help case : It displays help information.

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads