[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bash extended glob - Negation
From: |
Oğuz |
Subject: |
Re: Bash extended glob - Negation |
Date: |
Fri, 30 Apr 2021 12:14:19 +0300 |
30 Nisan 2021 Cuma tarihinde Robert Elz <kre@munnari.oz.au> yazdı:
> Date: Fri, 30 Apr 2021 12:28:32 +0530
> From: Inian Vasanth <inian.vasanth@gmail.com>
> Message-ID: <CADNZbLRBuvtihJC-EsY0NKeMsVibTKvgpQ33qve_g-yZ=R
> 3u_Q@mail.gmail.com>
>
> | Why is it the case? Shouldn't the glob expression just serve the !(8)
> | pattern to exclude and simply do a no-op for the extra * character?
>
> The '*' means "sero or more of the preceding", the preceding was
> "not an 8" so anything which ends with zero (or more) not 8's matches.
No, this isn't regex. `*' alone means zero or more of anything. What OP
doesn't understand here is that `!(8)' can match the empty string. A
simpler example would be:
$ touch a b c
$ echo !([ab])
c
$ echo !([ab])*
a b c
> Since everything ends with 0 (or more) not 8's (or not anything elses)
> everything matches.
>
> kre
>
>
>
--
Oğuz