Switch statement with case

suggest change

With the case statement you can match values against one variable.

The argument passed to case is expanded and try to match against each patterns.

If a match is found, the commands upto ;; are executed.

case "$BASH_VERSION" in
 [34]*)
    echo {1..4}
    ;;  
  *)
    seq -s" " 1 4
esac

Pattern are not regular expressions but shell pattern matching (aka globs).

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents