help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: help with pattern matching needed


From: Christoph Anton Mitterer
Subject: Re: help with pattern matching needed
Date: Wed, 12 Jan 2022 15:36:05 +0100
User-agent: Evolution 3.42.2-1

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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]