From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 138 invoked by alias); 25 Jan 2015 20:24:43 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 34390 Received: (qmail 18202 invoked from network); 25 Jan 2015 20:24:42 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=Ko/6AtSI c=1 sm=1 tr=0 a=FT8er97JFeGWzr5TCOCO5w==:117 a=kj9zAlcOel0A:10 a=q2GGsy2AAAAA:8 a=oR5dmqMzAAAA:8 a=-9mUelKeXuEA:10 a=YNv0rlydsVwA:10 a=uGq9eoaNgRitXFMkEsQA:9 a=CjuIK1q_8ugA:10 From: Bart Schaefer Message-id: <150125122410.ZM31619@torch.brasslantern.com> Date: Sun, 25 Jan 2015 12:24:10 -0800 In-reply-to: <1422177338-85472-1-git-send-email-tomoki.sekiyama@gmail.com> Comments: In reply to Tomoki Sekiyama "[PATCH] Enable further expansion of parameter name by ${!...}" (Jan 25, 4:15am) References: <1422177338-85472-1-git-send-email-tomoki.sekiyama@gmail.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Tomoki Sekiyama , zsh-workers@zsh.org Subject: Re: [PATCH] Enable further expansion of parameter name by ${!...} MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Jan 25, 4:15am, Tomoki Sekiyama wrote: } Subject: [PATCH] Enable further expansion of parameter name by ${!...} } } With this change, ${!...} will enable further expansion of parameter name, } which is equivalent to (P) expansion flag. This will enable zsh to run some } scripts using variable references for bash. Don't we already have something like this for ksh emulation? Except that it acts like (k) instead of like (P)? Although I can't find this in the documentation anywhere, right at the moment. I'm not going to commit this without some more discussion, though, because it seems a bit iffy to have exactly the same syntax mean two such very different things. At the very least perhaps both branches should depend on emulation modes rather than having the bash behavior become a default. diff --git a/Src/subst.c b/Src/subst.c index a2bb648..882e62c 100644 --- a/Src/subst.c +++ b/Src/subst.c @@ -1734,8 +1734,11 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags) * doesn't have parameter flags it might be neater to * handle this with the ^, =, ~ stuff, below. */ - if ((c = *s) == '!' && s[1] != Outbrace && EMULATION(EMULATE_KSH)) { - hkeys = SCANPM_WANTKEYS; + if ((c = *s) == '!' && s[1] != Outbrace) { + if (EMULATION(EMULATE_KSH)) + hkeys = SCANPM_WANTKEYS; + else /* emulate bash equivalent to our (P) */ + aspar = 1; s++; } else if (c == '(' || c == Inpar) { char *t, sav;