Fall through only if subsequent patterns match
suggest changeSince 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.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents