case
Verified for current stable LTS
Case Command: Combine Patterns With Fallback
Use for combine patterns with fallback with Case. Exact CLI syntax to combine patterns with fallback using Case.
When to use this: Use for combine patterns with fallback with Case.
Command Syntax
case <$COUNTRULE> in <[wW]|words>) <wc --words README> ;; <[lL]|lines>) <wc --lines README> ;; *) <echo "what?"> ;; esac case <$env:COUNTRULE> in <[wW]|words>) <wc --words README> ;; <[lL]|lines>) <wc --lines README> ;; *) <echo "what?"> ;; esac Command Breakdown
--words- Command Option
- Tool-specific option used by this command invocation.
--lines- Command Option
- Tool-specific option used by this command invocation.
FAQ
Purpose: Exact syntax to combine patterns with fallback using Case.
Test path: Replace placeholders and run destructive commands in a disposable workspace first.
Flag behavior: Tool version, platform, and shell can change behavior.
Improve This Command
Suggest a correction, safer default, or version-specific note for this entry.
Related Operations
Case Command: Allow Matching Multiple Patterns
case <$ANIMAL> in <cat>) <echo "It's a cat"> ;;& <cat|dog>) <echo "It's a cat or a dog"> ;;& *) <echo "Fallback"> ;; esac Case Command: Allow Multiple Patterns case <$ANIMAL> in <cat>) <echo "It's a cat"> ;;& <cat|dog>) <echo "It's a cat or a dog"> ;;& *) <echo "Fallback"> ;; esac Case Command: Continue Next Patterns Commands case <$ANIMAL> in <cat>) <echo "It's a cat"> ;& <dog>) <echo "It's either a dog or cat fell through"> ;& *) <echo "Fallback"> ;; esac Case Command: Continue To Next Patterns Commands case <$ANIMAL> in <cat>) <echo "It's a cat"> ;& <dog>) <echo "It's either a dog or cat fell through"> ;& *) <echo "Fallback"> ;; esac Case Command: Display Help For Case help case