help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] Destroying arbitrary subset in an associative array?


From: Mingye Wang (Arthur2e5)
Subject: Re: [Help-bash] Destroying arbitrary subset in an associative array?
Date: Mon, 19 Sep 2016 21:13:31 -0400
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2



DD > Bash evaluates expansions in array indices dynamically as part of the
DD > process of resolving its value. Often that means array indices must be
DD > regarded as unexpanded strings that are dynamically evaluated later.

Hmm..
GW > The more complex reason is... whatever Dan said.
GW > ...
GW > imadev:~$ dictdel() { unset -v 'dict[$1]'; }

That's exactly what I am looking for. Now I can see the 'expanded later' part.

DD > When a[$x] becomes a[]] or a['] etc. Yes, not quoting the glob is also
DD > wrong, but the more immediate problem here is bash to treating the
DD > index value as syntax because the $x was expanded first.

Thanks for all your explanation. Yes, the glob is a gotcha too...

--
Regards,

Arthur2e5

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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