Fall through only if subsequent patterns match

suggest change

Since Bash 4.0, another operator ;;& was introduced which also provides fall through only if the patterns in subsequent case statement(s), if any, match.

#!/bin/bash

var=abc
case $var in
a*)
  echo "Antartica"
  ;;&
xyz)
  echo "Brazil"
  ;;&
*b*)
  echo "Cat"
  ;;&
esac

Outputs:

Antartica
Cat

In the below example, the abc matches both first and third case but not the second case. So, second case is not executed.

Feedback about page:

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



Table Of Contents