Match one variable against several patterns.
Section: Tests and Conditionals
Pattern matching with case
bash
bash
case "$ext" in
jpg|png) echo image ;;
txt) echo text ;;
*) echo other ;;
esacExplanation
case is usually clearer than many if/elif checks.
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 Tests and Conditionals