I’m working with a case statement similar to:
Case "$myvar" in
[aA]) {
#dostuff
};;
Esac
My goal is to catch instances of the input string containing a or A, disregarding the rest of the string. Trouble is, given inputs containing something else (ab, for example) the string is not caught by my case statement. I’m sure the issue is with my regex implementation but I don’t know how to fix it.
A case statement in bash takes a glob, not a regex. And the glob matches the whole string. So to find any instance of the letter “A”, you would do: