System Grab Bag

View all TLDR pages from common (or from all pages)

case

Bash builtin construct for creating multi-choice conditional statements. More information: https://www.gnu.org/software/bash/manual/bash.html#index-case.
  • Match a variable against string literals to decide which command to run:
    case {{$tocount}} in {{words}}) {{wc -w README}}; ;; {{lines}}) {{wc -l README}}; ;; esac
  • Combine patterns with |, use * as a fallback pattern:
    case {{$tocount}} in {{[wW]|words}}) {{wc -w README}}; ;; {{[lL]|lines}}) {{wc -l README}}; ;; *) {{echo "what?"}}; ;; esac

License and Disclaimer

The content on this page is copyright © 2014—present the tldr-pages team and contributors.
This page is used with permission under Creative Commons Attribution 4.0 International License.

While we do attempt to make sure content is accurate, there isn't a warranty of any kind.