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

clone an associative array?



hello all,

i don't know what i missed in 'parameters expansions' manual but i'm
unable to clone an associative array :

% typeset -A homemade
% homemade=( tm myself c 2005 )
% echo $homemade[tm]
myself

% typeset -A counterfeit
% counterfeit=${homemade}

% echo $counterfeit[c]
m

% counterfeit="${homemade}"
% echo $counterfeit[c]
m

% counterfeit="${(AA)homemade}"
% echo $counterfeit[c]
m

% counterfeit="${(A)homemade}"
% echo $counterfeit[c]
m

# other tries failed too ...

in a future time, i would like to write something as :

func () {
    local who=$1
    shift
    local -A config
    config=$@

    # implementation here ....

}

i'm sure that it is possible, i just want to know how.

regards
mc



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