help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: why fail , [[ $sep$*$sep == $sep--$sep ]]


From: Chet Ramey
Subject: Re: why fail , [[ $sep$*$sep == $sep--$sep ]]
Date: Tue, 20 Feb 2024 10:34:43 -0500
User-agent: Mozilla Thunderbird

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.

Chet

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/




reply via email to

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