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: Lawrence Velázquez
Subject: Re: help with pattern matching needed
Date: Fri, 07 Jan 2022 18:44:03 -0500
User-agent: Cyrus-JMAP/3.5.0-alpha0-4526-gbc24f4957e-fm-20220105.001-gbc24f495

Most of the questions here are addressed by Chet's message and the
one I just sent, but...


On Fri, Jan 7, 2022, at 5:15 PM, Christoph Anton Mitterer wrote:
> But isn't this then a violation of POSIX? Or is there any part in it,
> which indicates that behaviour, i.e. that already quoted strings are
> already taken as literals with respect to the pattern?

As I noted in the message I just sent, POSIX doesn't actually say
that case patterns undergo quote removal; rather, it addresses
quoting in its description of pattern matching.  This kinda sorta
covers the observed behavior, but it could certainly be clearer.


> And even stranger that (d)ash then matches [.xxxxxxxxxxxx^$[] ... how
> did you construct that?
>
> Or is there any logic behind it? Perhaps, that since it doesn't finde a
> closing ] (because that's taken literally, it also takes the first [
> literally?

More or less.  Without an unquoted ], there is no bracket expression,
so:

    - The unquoted [ characters match literally.
    - The unquoted * retains its special meaning and matches zero
      or more arbitrary characters.


-- 
vq



reply via email to

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