[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/
>
>
- Re: why fail , [[ $sep$*$sep == $sep--$sep ]], (continued)
- Re: why fail , [[ $sep$*$sep == $sep--$sep ]], alex xmb sw ratchev, 2024/02/18
- Re: why fail , [[ $sep$*$sep == $sep--$sep ]], Kerin Millar, 2024/02/18
- Re: why fail , [[ $sep$*$sep == $sep--$sep ]], alex xmb sw ratchev, 2024/02/18
- Re: why fail , [[ $sep$*$sep == $sep--$sep ]], alex xmb sw ratchev, 2024/02/18
- Re: why fail , [[ $sep$*$sep == $sep--$sep ]], Kerin Millar, 2024/02/18
- Re: why fail , [[ $sep$*$sep == $sep--$sep ]], Chet Ramey, 2024/02/20
- 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 <=
Re: why fail , [[ $sep$*$sep == $sep--$sep ]], Chet Ramey, 2024/02/20