From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5808 invoked by alias); 14 May 2011 18:41:23 -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: 29290 Received: (qmail 11446 invoked from network); 14 May 2011 18:41:18 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) 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.1 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <110514114104.ZM14616@torch.brasslantern.com> Date: Sat, 14 May 2011 11:41:04 -0700 In-reply-to: <20110514114156.GA12539@stack.nl> Comments: In reply to Jilles Tjoelker "Re: PATCH: expanding parameters like echo/print builtins" (May 14, 1:41pm) References: <20110514114156.GA12539@stack.nl> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: PATCH: expanding parameters like echo/print builtins MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On May 14, 1:41pm, Jilles Tjoelker wrote: } Subject: Re: PATCH: expanding parameters like echo/print builtins } } > [${(g)parameter} expansion for expanding like echo/print] } } Am I really strange in thinking this should really be done using command } substitution of echo, print or printf with appropriate options? A lot of features added to zsh are things that could be done another way but that it's more convenient to have a shortcut. E.g., one could argue that $((5 + 3)) should really be done using $(expr 5 + 3), etc. } Admittedly, this requires precautions if trailing newlines are } significant [...] } Other tricks are using eval with $'...' (requires special care for ' } and is not in POSIX.1-2008). It's often precisely to avoid those precautions and "special care" cases that things like (g) get introduced. } In general, I think the ${(foo)parameter} forms are mostly write-only } code for interactive use, except perhaps if you use them a lot. I think you've got that exactly backward. :-) If these forms were primarily for interactive use, the syntax would probably be a lot less convoluted. $'...' is for interactive use. ${(g:oe:)...}, not so much.