cc: [email protected]
Subject: Re: [ast-users] [ksh93] `alias not found' for `arr=( a b )'
--------
> $ echo ${.sh.version}
> Version JMP 93u+ 2012-02-14
> $ alias a=alias
> $ alias b='cd -'
> $ typeset -a arr=( a b )
> $ arr=( a b )
> b: alias not found <-- Bug? Why are aiases involved here?
> $ arr=( b a )
> $
>
> (attachment 1 7/334 text/html "1.att")
>
The form
var=(...)
is a generic compound variable assignment. It is use for
indexed arrays, associative arrays, and for compound variables.
However, in some cases this is ambiguous.
var=()
is this an empty compound variable, an empty indexed array, or
an empty associative array. By default, ambiguities lean towards
selection the compound variable.
Another example,
var=(integer x=3)
This will be treated as a compound assignment defining x=3. However,
in order for this to work, the alias integer must be recognized.
Therefore, by default, the first work is alias expanded.
Therefore, it is best to explicity specify which you want.
typeset -a var=(integer x=3)
will define an indexed array with two elements, integer and x=3. The
first argument will not be checked for aliases.
typeset -a var=([3]=abc [foo]=def)
will define an indexed array with elements 3 and the arithmetic value
of foo $((foo)).
Use
typeset -A for associative array definition.
Use
typeset -C for compound assignment.
David Korn
[email protected]
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users