case $VAR in
val1) cmd1 ;;
val2) cmd2 ;;
*) default ;;
esac
Category: Bash Scripting
case $VAR in
val1) cmd1 ;;
val2) cmd2 ;;
*) default ;;
esac
Case statement for matching variable against patterns
A case statement matches a variable against multiple patterns — cleaner than many if/elif/else chains.