Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: foo=($bar) vs foo=("$bar[@]")
- X-seq: zsh-users 633
- From: Zefram <zefram@xxxxxxxxxxxxxxxxx>
- To: roderick@xxxxxxxx (Roderick Schertler)
- Subject: Re: foo=($bar) vs foo=("$bar[@]")
- Date: Wed, 29 Jan 1997 15:17:35 +0000 (GMT)
- Cc: zsh-users@xxxxxxxxxxxxxxx
- In-reply-to: <27155.854514452@xxxxxxxxxxxxxxxxx> from "Roderick Schertler" at Jan 29, 97 00:07:32 am
Roderick Schertler wrote:
>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?
"$bar[@]" works in all cases, but $bar will drop empty array elements:
% foo=(a '' b)
% bar1=($foo)
% bar2=("$foo[@]")
% echo $#foo $#bar1 $#bar2
3 2 3
Also $bar is at the mercy of several options, but in "$bar[@]"
everything is explicit.
-zefram
Messages sorted by:
Reverse Date,
Date,
Thread,
Author