Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: zsh-3.1.5-pws-7: "$a[@]" with $a unset
- X-seq: zsh-workers 5357
- From: Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: PATCH: zsh-3.1.5-pws-7: "$a[@]" with $a unset
- Date: Fri, 12 Feb 1999 16:45:38 +0100
- In-reply-to: ""Bart Schaefer""'s message of "Fri, 12 Feb 1999 07:43:45 NFT." <990212074345.ZM8144@xxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
> } Sven Wischnowsky wrote:
> } > % foo() { echo $# }
> } > % unset a
> } > % foo $a[@]
> } > 0 # fine
> } > % foo "$a[@]"
> } > 1 # oops
>
> That's not an "oops". That's the way it's supposed to work. Try the
> equivalent code in bash.
Bash doesn't even have arrays, apart from "$@", of course. Try it in
ksh, and remember you need "${f[@]}" because the bracing rules are
more strict, and you'll find it elides the whole thing as with the
patch.
Taking a @ subscript was never a well-defined thing to do on a scalar,
whether or not it happens to be so with a zsh extension; its essential
purpose is to provide word splitting for arrays in strings, so zero
elements gives zero words. (And if it leaves a null argument on the
line for an empty scalar, I would argue that's inconsistently
implemented.)
> I don't think we want this patch.
It seems pretty clear to me the shell is just plain broken without it.
--
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx> Tel: +39 050 844536
WWW: http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy
Messages sorted by:
Reverse Date,
Date,
Thread,
Author