Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: unset "hash[key]" isn't matched with what "key" may be



On Sun, 7 Feb 2016 15:16:05 +0100
Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx> wrote:
> I had a loop in which I browsed $functions, setting:
> 
>                 func[$i]=1
> 
> where "func" is a hash and "$i" is ${(k)functions}. This worked, however this:
> 
>                 unset "func[$i]"

Not sure what you're doing, but it's apparently not equivalent to the
following, which appears to work.  There may be some relevant option,
I suppose.

% i='${(k)functions}'
% typeset -A hash
% hash[$i]=1
% print ${(kv)hash}
${(k)functions} 1
% unset "hash[$i]"
% print ${(kv)hash}
<this line intentionally left blank>

PWS



Messages sorted by: Reverse Date, Date, Thread, Author