bug-bash
[Top][All Lists]
Advanced

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

Re: Changing the way bash expands associative array subscripts


From: konsolebox
Subject: Re: Changing the way bash expands associative array subscripts
Date: Tue, 6 Apr 2021 06:49:52 +0800

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)'
> > a[$key]=1
> > 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*?  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.


-- 
konsolebox



reply via email to

[Prev in Thread] Current Thread [Next in Thread]