Bash Case statement edit

Case statement with fall through

Since bash 4.0, a new operator ;& was introduced which provides fall through mechanism.

#!/bin/bash

var=1
case $var in
1)
  echo "Antartica"
  ;&
2)
  echo "Brazil"
  ;&
3)
  echo "Cat"
  ;&
esac

Outputs:

Antartica
Brazil
Cat

Feedback about page:

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

  ↑ ↓ to navigate     ↵ to select     Esc to close