Clark, ar=() creates an empty compound variable, not an array. You can use typeset +p ar to see the typeset attributes currently being defined for a specific variable.
As a rule of good shell script coding style, always declare variables with non string types using typeset <typespec> <varname> before using them. Olga On Tue, Mar 13, 2012 at 9:00 AM, Clark J. Wang <[email protected]> wrote: > $ echo ${.sh.version} > Version JMP 93u+ 2012-02-14 > $ arr=( ) > $ echo "$arr" > ( > ) <---- ??? > $ typeset -a arr=( ) <-- But this works fine. > $ echo "$arr" > > $ > > Another case: > > $ typeset -a arr=( ( 11 22 33 ) ( 44 55 ) ) > $ arr[1]+=( 66 ) > $ echo ${arr[1][@]} > 44 55 66 > $ arr[1]=( ) <-- Here I want to set arr[1] to an empty array > ksh-20120214: 1: invalid variable name > $ > > _______________________________________________ > ast-users mailing list > [email protected] > https://mailman.research.att.com/mailman/listinfo/ast-users > -- , _ _ , { \/`o;====- Olga Kryzhanovska -====;o`\/ } .----'-/`-/ [email protected] \-`\-'----. `'-..-| / http://twitter.com/fleyta \ |-..-'` /\/\ Solaris/BSD//C/C++ programmer /\/\ `--` `--` _______________________________________________ ast-users mailing list [email protected] https://mailman.research.att.com/mailman/listinfo/ast-users
