The following command sequence (slightly altered for clarity) was
entered while investigating the discussion in
http://lists.research.att.com/pipermail/ast-users/2013q3/004188.html.

    $ print ${.sh.version}
    Version AJM 93u+ 2012-06-12
    $ index=1
    $ print ${!not_an_array[index]}
    not_an_array[index]
    $ set | grep array
    _='not_an_array[index]'
    $ typeset -n ref=not_an_array[index]
    $ set | grep array
    not_an_array=([0]=)
    ref='not_an_array[1]'[1]
    $ print ${!not_an_array[index]}
    not_an_array[1]
    $ unset not_an_array
    $ set | grep array
    _=not_an_array
    not_an_array=([0]=)
    ref='not_an_array[1]'[1]
    $ unset -n ref
    $ set | grep array
    not_an_array=([0]=)
    $ unset not_an_array
    $ set | grep array
    _=not_an_array
    not_an_array=([0]=)
    $


    I note the following bugs therein:

   1. "typeset -n ref=not_an_array[a]" magically creates the associative
      array, not_an_array, with empty element "0". Before that
      not_an_array didn't exist.

   2. After that the output of "print ${!not_an_array[index]}" changes
      from "not_an_array[index]" to "not_an_array[1]".

   3. The magically created not_an_array cannot be unset even after ref
      is unset.


    Note that this occurred in ksh-u. You guys have made a lot of
corrections to name references and the output of the set command since
ksh-u. Maybe these bugs don't even exist anymore.

                    Terrence Doyle
_______________________________________________
ast-users mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-users

Reply via email to