[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: help with pattern matching needed
From: |
Kerin Millar |
Subject: |
Re: help with pattern matching needed |
Date: |
Wed, 12 Jan 2022 15:45:01 +0000 |
On Wed, 12 Jan 2022 15:36:05 +0100
Christoph Anton Mitterer <calestyo@scientia.org> wrote:
> 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?
Naturally. A quoted circumflex would constitute a literal circumflex in exactly
the same way that a quoted exclamation mark would constitute a literal
exclamation mark.
$ touch '!' a b
$ echo [!b]
! a
$ echo ['!'b]
! b
$ echo [\!b]
! b
--
Kerin Millar
- Re: help with pattern matching needed, (continued)
- Re: help with pattern matching needed, Christoph Anton Mitterer, 2022/01/12
- Re: help with pattern matching needed, Christoph Anton Mitterer, 2022/01/12
- Re: help with pattern matching needed, Lawrence Velázquez, 2022/01/12
- Re: help with pattern matching needed, Christoph Anton Mitterer, 2022/01/12
- Re: help with pattern matching needed, Greg Wooledge, 2022/01/12
- Re: help with pattern matching needed, Christoph Anton Mitterer, 2022/01/12
- Re: help with pattern matching needed, Greg Wooledge, 2022/01/12
- Re: help with pattern matching needed, Chet Ramey, 2022/01/12
- Re: help with pattern matching needed,
Kerin Millar <=