A case statement compares one value against several shell patterns. It keeps command dispatch readable.

Program

Play the script to see the restart pattern choose the cycle action.

case_patterns.sh
#!/usr/bin/env bash

command="restart"
case "$command" in
  start) action="boot" ;;
  stop) action="halt" ;;
  restart) action="cycle" ;;
  *) action="unknown" ;;
esac
echo "$action"
case `case` selects the first pattern that matches a value.
fallback pattern `*` catches values that do not match an earlier pattern.