Pattern Matching
Something I’ve found extremely confusing in Bash is the difference between regular expressions as used by grep, sed… and globbing used by Bash (except in [[ $X =~ regex ]]
).
Furthermore, the pattern-list notation as in ?(pattern-list)
in the manual don’t work by default, but require
shopt -s extglob
to be set at the top of the script.