From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19905 invoked from network); 1 Jun 1999 08:49:32 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 1 Jun 1999 08:49:32 -0000 Received: (qmail 10686 invoked by alias); 1 Jun 1999 08:49:19 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6413 Received: (qmail 10587 invoked from network); 1 Jun 1999 08:49:15 -0000 Message-Id: <9906010821.AA38598@ibmth.df.unipi.it> To: "Zsh hackers list" Subject: Re: PATCH: pws-19: minor syntactic innovation In-Reply-To: ""Andrej Borsenkow""'s message of "Tue, 01 Jun 1999 10:23:48 DFT." <00eb01beabf7$4edde7b0$21c9ca95@mow.siemens.ru> Date: Tue, 01 Jun 1999 10:21:40 +0200 From: Peter Stephenson "Andrej Borsenkow" wrote: > > What's the parse of something like ${(f)"${"$(typeset)"}"} ? It doesn't > > seem to be the `obvious' one -- it appears that the quoted strings are > > actually nesting, because of the enclosing braces, which is something > > pretty radically new. (I may be wrong.) Is this a good thing? > > No. It breaks the basic shell grammar. The main problem is, it can have > unexpected side effects when running in sh or ksh compatibility mode - and > this is definitely bad thing. This isn't due to the change I made, it simply showed up because of that. The cause is dquote_parse(), which is doing brace-counting; in other words, it rejects the second `"' as the end of the quoted string because it detected the ${. So this behaviour seems to be entirely deliberate. I'm not so sure it's either new or wrong. I discovered in an initialisation file here, if [ -n "${BASH_VERSION:-""}" ]; then which is obviously for bash rather than zsh (and works in bash, too). If the quotes don't parse in a nested fashion, this is meaningless, and wouldn't parse in zsh because it always matches up braces, including inside quotes. Furthermore, bash$ echo "${FOO" > It's at the continuation prompt, so it's still parsing after the brace, just like zsh (bash will report an error if it ever gets the remaining `"}"', though). sh reports `bad subsitution' at this point, however; but even so, I can't think offhand of a working piece of sh code which would be broken by this feature. The fact that bash works happily as sh tends to reinforce that view. -- Peter Stephenson Tel: +39 050 844536 WWW: http://www.ifh.de/~pws/ Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy