Skip to content

Latest commit

 

History

History
31 lines (20 loc) · 545 Bytes

README.md

File metadata and controls

31 lines (20 loc) · 545 Bytes

Bash Case Statement

  • A branching/control-flow mechanism in Bash
  • Execute Commands based on what pattern an expression matches.
case EXPRESSION in
  PATTERN1) COMMANDS ;;
  PATTERN2) COMMANDS ;;
  PATTERN3) COMMANDS ;;
  ...
esac
  • Patterns are shell patterns, not Regular Expressions.
  • Matching is done top to bottom and matching stops after the first match.

Related:

Reference:

  • man bash

Tags:

#literature-note #scripting #syntax