On Wed, 2022-01-12 at 07:38 -0500, Greg Wooledge wrote:
> The quotes are irrelevant; you should get the same results if you
> remove them.
>
> POSIX only specifies ! as the negation character for [...] ranges in
> globs.
> Some shells also permit ^ to be used, for the comfort of people who
> are
> used to regular expressions. Bash is one of the shells that permit
> ^.
But doesn't POSIX explicitly say:
"A bracket expression starting with an unquoted <circumflex> character
produces unspecified results."
Which I'd interpret as also meaning that a quoted ^ is not allowed
produce unspecified results?
> The behavior of dash has changed in recent years. On Debian 11:
>
> unicorn:~$ dash
> $ case a in [^.a]) echo match;; *) echo not;; esac
> not
>
> But if I perform that same test on a much older Debian system, I get
> the result "match" -- because the ^ is not treated as a range
> negation
> character in that version.
Yes I could verify that... but you use the unquoted versions, I the
quoted ones.
> Presumably your system is using one of the older versions of dash.Â
Well my original tests were all with Debian sid's:
bash 5.1
busybox 1.30.1
dash 0.5.11+git20210903+057cd650a4ed
klibc-utils 2.0.10
Cheers,
Chris.