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 11:23:31 -0500
User-agent: Mozilla Thunderbird

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.

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