I'm trying to get a case statement to match one of four inputs in a Bash/Zsh shell:
You can see where I'm going, right?
I'm looking for this in the below case statement:
case "$1" in ?(--)version|?(-)v) # do stuff ;; esac
And I find that this isn't working. From what I've read, ?(pattern) is how to match 0 or one occurrences of a pattern.
I did have it working by matching the case
But it would be nice to have something neater, plus, it's a learning experience!
I imagine this is probably down to me not escaping things properly, but I also tried encompassing my original string in double quotes ("), yet I got no output again.