Consider this test script:
(set -o posix) 2>/dev/null && set -o posix
emulate sh 2>/dev/null # for zsh
for var in 'a-c' '!a'; do
case b in
( ["$var"] ) echo 'quirk' ;;
( [$var] ) echo 'no quirk' ;;
Most shells output 'no quirk' for both values of 'var', but AT&T ksh93
outputs 'quirk' for both, as does zsh 5.2 and earlier (zsh-as-sh changed
to match the majority in 5.3). Now one of the current ksh93 lead
developers says this does not look like a bug.
Does POSIX specify anything, either way, regarding the effect of shell
quoting within glob bracket patterns? I can't find any relevant text
under "2.13 Pattern Matching Notation" or anything it references, so
clarification would be appreciated.