cc: [email protected]
Subject: Re: [ast-users] [ksh93] `typeset -A arr' did not unset arr first
--------
> $ echo $KSH_VERSION
> Version JMP 93u+ 2012-02-29
> $ arr=( )
> $ typeset -p arr
> typeset -C arr=()
> $ typeset -A arr <-- explicitly change the attribute
> $ typeset -p arr
> typeset -A arr=([0]=()) <-- I would expect arr to be an empty
> associative array here ??
The typeset -A changed arr into an associative array and an value it had
becomes the 0 element of this array.
> $ unset arr
> $ typeset -p arr
> typeset -C arr=() <-- It was not unset ??
typeset -p arr only unsets the 0th element. You need to use
typeset -p arr[@]
to unset all the elements of an array.
Note that $arr is equivalent to ${arr[0]}
> $ unset -v arr
> $ typeset -p arr
> typeset -C arr=()
> $
>
David Korn
[email protected]
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users