On Tue, 5 May 2009 21:17 ольга крыжановская wrote: > On 5/4/09, David Korn <[email protected]> wrote: > > Subject: Re: Re: [ast-users] Swapping array elements through temporary > > variable == typeset: : invalid variable name -------- > > > > > > The following one line example should print "cc bb aa" but yields > > > > to a syntax error: > > > > > > > > ksh93 -c 'typeset -a a=( [0]="aa" [1]="bb" [2]="cc" ) ; typeset -m > > > > 'j=a[0]' ; typeset -m 'a[0]=a[1]' ; typeset -m 'a[1]=j' ; print > > > > "$...@]}"' > > > > ksh93[1]: typeset: : invalid variable name > > > > > > > > Is this a bug or am I doing something wrong? > > > > > > typeset -m a=b should rename variable b to a. > > > > It works for variables (including array variables), but not for > > individual array elements. > > That does not sound very useful. IMO typeset -m should allow to move > any kind of variable, including whole arrays or individual array > elements, to a local variable and a local variable into an array > element.
have to disagree. Sounds rational IMHO. An array element is an atomic item that can be re-assigned as required and the element in the array unset as required to achieve the effect you require. _______________________________________________ ast-users mailing list [email protected] https://mailman.research.att.com/mailman/listinfo/ast-users
