[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: why fail , [[ $sep$*$sep == $sep--$sep ]]
From: |
Kerin Millar |
Subject: |
Re: why fail , [[ $sep$*$sep == $sep--$sep ]] |
Date: |
Tue, 20 Feb 2024 16:06:14 +0000 |
On Tue, 20 Feb 2024 15:46:22 +0000
Kerin Millar <kfm@plushkava.net> wrote:
> On Tue, 20 Feb 2024 10:34:43 -0500
> Chet Ramey <chet.ramey@case.edu> wrote:
>
> > On 2/17/24 10:07 AM, alex xmb sw ratchev wrote:
> > > i was trying and epic failed
> > >
> > > set aa bb cc -- dd ; f=$'\1' IFS=$f ; [[ $f$*$f == "$f--$f" ]] && echo ye
> > >
> > > it says no ye
> >
> > It looks like you've found a bug that manifests itself under a very
> > specific set of circumstances: IFS=$'\1', word splitting not performed,
> > and an unquoted word. Bash doesn't quote the ^A sufficiently, and since
> > it uses ^A as an internal quote character, removes it. This causes the
> > match to fail. There are other places this happens: case commands, shell
> > pattern expansion, and array subscript expansion.
> >
> > I pushed a fix for it this morning; there is another change in the
> > pipeline.
>
> Thanks.
Though it is not particularly important at this juncture, I would add that
Alex's pattern was wrong to begin with. I corrected the pattern and provided
some diagnostics but it was actually Lawrence who identified - and initially
raised - the discrepancy concerning the handling of $'\1'.
--
Kerin Millar
- Re: why fail , [[ $sep$*$sep == $sep--$sep ]], (continued)
- Re: why fail , [[ $sep$*$sep == $sep--$sep ]], Lawrence Velázquez, 2024/02/18
- Re: why fail , [[ $sep$*$sep == $sep--$sep ]], Kerin Millar, 2024/02/18
- Re: why fail , [[ $sep$*$sep == $sep--$sep ]], Greg Wooledge, 2024/02/18
- Re: why fail , [[ $sep$*$sep == $sep--$sep ]], Chet Ramey, 2024/02/20
- Re: why fail , [[ $sep$*$sep == $sep--$sep ]], alex xmb sw ratchev, 2024/02/20
Re: why fail , [[ $sep$*$sep == $sep--$sep ]], Chet Ramey, 2024/02/20