Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: array1=array2 ???



Frank Terbeck wrote:

 Now I want "b" to become equal to "a".
 How can I copy one array to another?

  b=( $a )

not really : b is a 'compressed" a (without empty elements) . you must use "$a[@]" to preserve all elements.

> a=( a '' c ); b=( $a ); c=( "$a[@]")
> echo $#a $#b $#c
3 2 3

HTH,
mc



Messages sorted by: Reverse Date, Date, Thread, Author