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

foo=($bar) vs foo=("$bar[@]")



The NEWS file says

    foo=$bar no longer creates an array even if bar is an array.  Use
    foo=( $bar ) or even better, foo=( "$bar[@]" ) instead.

In what way is "$bar[@]" better than $bar?  The extra line noise is a
point in favor of the simpler form, what benefit outweighs it?

I hope it's not just that it makes ksh programmers feel at home!  Being
able to say just $bar is one of zsh's big advantages in array handling.

-- 
Roderick Schertler
roderick@xxxxxxxx



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