Skip to content

Commit 7ace356

Browse files
committed
docs(bash): prefer case over long if/elif chains
- Prefer case for single value/pattern branching
1 parent 6023bdc commit 7ace356

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

rules/140-bash.mdc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ files:
2323
- **"Portability matters"** - Prefer POSIX-compliant code when possible, document Bash-specific features
2424
- **"Security by default"** - Sanitize inputs, use `mktemp`, avoid `eval`, validate file paths
2525
- **"Composition over complexity"** - Small functions, clear separation of concerns, reusable patterns
26+
- **"Prefer `case` for branching"** - When matching on a single value/pattern, prefer `case` over long `if/elif/else` chains
2627
- **"Observability is essential"** - Structured logging, proper exit codes, error context
2728
- **"Test what you write"** - Use shellcheck, test on multiple platforms, write BATS tests
2829

0 commit comments

Comments
 (0)