From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4254 invoked by alias); 13 Oct 2010 09:04:49 -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: 28347 Received: (qmail 28380 invoked from network); 13 Oct 2010 09:04:46 -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=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at csr.com does not designate permitted sender hosts) Date: Wed, 13 Oct 2010 10:04:35 +0100 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: print -D and ${(D)} quoting Message-ID: <20101013100435.4d3ae3f7@pwslap01u.europe.root.pri> In-Reply-To: <101012185649.ZM20220@torch.brasslantern.com> References: <4637.1286902367@csr.com> <20101012215339.26037042@pws-pc> <101012185649.ZM20220@torch.brasslantern.com> Organization: Cambridge Silicon Radio X-Mailer: Claws Mail 3.7.6 (GTK+ 2.18.9; i686-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 13 Oct 2010 09:04:35.0335 (UTC) FILETIME=[A82D3170:01CB6AB5] X-Scanned-By: MailControl A-06-00-00 (www.mailcontrol.com) on 10.68.0.125 On Tue, 12 Oct 2010 18:56:49 -0700 Bart Schaefer wrote: > Is quoting the rest of the string really the correct thing to do? My contention is that a string of the form "~/with space" is neither nowt nor something. > Consider ${${(D)foo}:r} or ${=${(D)foo}}. ${(D)${foo:r}} is the right way round, since the initial $foo is (by hypothesis) a path understood by the OS, while ${(D)foo} isn't, even without the quoting. But why are you doing file operations on a parameter and then turning it into something that's no longer a file (or, perhaps better put given what :r is typically used for, that doesn't allow you to construct a file name you can use in a shell expression)? I don't know what ${=${(D)foo}} is supposed to be useful for. > Why do you believe > ${(Q)$(D)foo}} should be necessary to operate on the original > string, modulo tilde contraction? Is it because that's easier > on a zsh script programmer than figuring out where to use (q)? Yes. With dynamic directory naming you can have ~[complexexpression]/stuff. It's valid to have a "/" in the complex expression. It's not a simple obvious operation to get a correctly formatted string even without that. Under what circumstances do you think it's useful to have a tilde expression that's not usable as a shell command line argument, anyway? Surely this can only be cosmetic, in which case having to add (Q) if you really want a string purely for display is perfectly reasonable? > Perhaps steps 13 and 14 from the "rules" should be combined in > some way, so (qD) together differs from either used alone? That looks a messier solution to me, though not unworkable given that you also have the safe option of ~${(q)${(D)...}}. -- Peter Stephenson Software Engineer Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom