Match input against multiple patterns.
Section: Conditionals Loops and Functions
Branch with case
bash
bash
case "$1" in start) echo start ;; stop) echo stop ;; *) echo usage ;; esacExplanation
Cleaner than long `if/elif` chains for command dispatch.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Conditionals Loops and Functions