[Top][All Lists]

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

Re: Changing the way bash expands associative array subscripts

From: Chet Ramey
Subject: Re: Changing the way bash expands associative array subscripts
Date: Thu, 8 Apr 2021 14:19:05 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.9.0

On 4/5/21 6:49 PM, konsolebox wrote:
On Mon, Apr 5, 2021 at 9:44 PM Chet Ramey <chet.ramey@case.edu> wrote:

On 4/1/21 3:02 PM, konsolebox wrote:

To do what, exactly?

To keep this working in both behaviors.

declare -A a
key='$(echo foo)'
unset 'a["$key"]'
declare -p a # declare -A a=()

I suppose. You'll be able to set compatibility levels to make this work
without resorting to wrappers.

Is it not possible to just have an added option to unset to make it
use old behavior without needing to use compat*?

I don't think that's a good solution. This is behavior that I have heard
complaints about for years. I'm not in favor of encouraging its continued
use if there's a fix in place.

Compatibility mode
affects general behavior and this isn't always something I'll need to
keep my scripts compatible.  In the manual I read "It's intended to be
a temporary solution" implying the script at one point should upgrade
its minimum version requirement and that's not what I'd want.

What is your end goal? To run the same script on different versions of
bash, or something else?

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