I was trying to find a way to safely initialize arr[n] to an empty indexed
array and I tried this:

$ cat foo.ksh
echo ${.sh.version}

typeset -a EMPTY_ARRAY=()
typeset -a g_arr=()

function initialize
{
    g_arr[0]=(11 22 33)
    g_arr[1]=( "${EMPTY_ARRAY[@]}" )
}

initialize
typeset -p g_arr[0]
typeset -p g_arr[1]
$ ksh foo.ksh
Version AJMP 93u+ 2012-08-01
typeset -a g_arr[0]=(11 22 33)
$

>From the result we can see g_arr[1] was not set at all which I think is not
correct. At least it should behave the same as `g_arr[1]=()'.
_______________________________________________
ast-users mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-users

Reply via email to