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: alex xmb sw ratchev
Subject: Re: why fail , [[ $sep$*$sep == $sep--$sep ]]
Date: Tue, 20 Feb 2024 17:35:29 +0100

On Tue, Feb 20, 2024, 17:23 Chet Ramey <chet.ramey@case.edu> wrote:

> On 2/18/24 3:56 PM, Lawrence Velázquez wrote:
>
> > This surprises me because IFS is not lost if it's set to something
> > a little less ... weird:
> >
> > $ (set aa bb cc -- dd; f=+ IFS=$f; set -x; [[ $f$*$f == *"$f--$f"* ]])
> > + [[ +aa+bb+cc+--+dd+ == *\+\-\-\+* ]]
> >
> > Why the difference?
>
> Bash uses ^A internally as a temporary quoting character. As a result, it
> needs to be careful about quoting ^A when it's in the result of a word
> expansion. It's not just IFS; it matters here because $* separates the
> positional parameter with the first character of $IFS.
>

there is an alternative technique than flat string replacements , a related
additonal data structure , with which u build the final cmd by

-- 
> ``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]