Re: [Help-bash] Why `echo !(*.l).c` behaves different depending on the c
From:
Peng Yu
Subject:
Re: [Help-bash] Why `echo !(*.l).c` behaves different depending on the context?
Date:
Fri, 8 Feb 2019 23:04:58 -0600
On Fri, Feb 8, 2019 at 10:19 PM Eduardo Bustamante <address@hidden> wrote:
>
> On Fri, Feb 8, 2019 at 8:04 PM Peng Yu <address@hidden> wrote:
> (...)
> > See below. `echo !(*.l).c` sometimes is OK but sometimes it is an
> > error. Is it a correct behavior?
>
> Yes. "extglob" changes the behavior of the parser. This behavior is
> correct and expected. Read: https://mywiki.wooledge.org/glob#extglob
I am not sure this link is relevant.
In both main.sh, extglob is enabled, the difference is in the `if`.
Why `if` can cause the code to be grammatically incorrect, but
removing`if` the code will be OK?
--
Regards,
Peng