Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14649 > unrolled thread

Re: assoc_expand_once issues

Started byChet Ramey <chet.ramey@case.edu>
First post2018-09-23 15:09 -0400
Last post2018-09-23 15:09 -0400
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: assoc_expand_once issues Chet Ramey <chet.ramey@case.edu> - 2018-09-23 15:09 -0400

#14649 — Re: assoc_expand_once issues

FromChet Ramey <chet.ramey@case.edu>
Date2018-09-23 15:09 -0400
SubjectRe: assoc_expand_once issues
Message-ID<mailman.1184.1537729784.1284.bug-bash@gnu.org>
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/

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web