bug-bash
[Top][All Lists]
Advanced

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

Re: assoc_expand_once issues


From: Chet Ramey
Subject: Re: assoc_expand_once issues
Date: Sun, 23 Sep 2018 15:09:33 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 9/20/18 6:37 PM, Grisha Levit wrote:
> I was testing out this new feature and I can't figure out how to handle
> certain characters in subscripts when the option is on.  Without the
> option,
> it is possible to escape the `$' in the subscript to achieve the desired
> result but obviously that does not work if the option *is* on -- is there a
> different workaround to use or is this a bug with assoc_expand_once?

Well, I don't think it's a bug, per se. There are three cases here:

1. Expansion performed both during word expansion of the assignment
   statement and during evaluation of the subscript.

2. Expansion performed during word expansion of the assignment statement.

3. Expansion performed during evaluation of the subscript.

Case 1 is what bash has always done. Case 2 is what assoc_expand_once
provides. Case 3 is what you want, and what you're simulating by quoting
the expansion in case 1.

I think there might be a way to take advantage of the information provided
by case 2 to do what you want with these (usually not allowed) subscripts.

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]