From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24644 invoked from network); 6 Jan 2006 10:39:12 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO autolearn=ham version=3.1.0 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 6 Jan 2006 10:39:12 -0000 Received: (qmail 86914 invoked from network); 6 Jan 2006 10:39:01 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 6 Jan 2006 10:39:01 -0000 Received: (qmail 16776 invoked by alias); 6 Jan 2006 10:38:54 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9814 Received: (qmail 16767 invoked from network); 6 Jan 2006 10:38:53 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 6 Jan 2006 10:38:53 -0000 Received: (qmail 85850 invoked from network); 6 Jan 2006 10:38:53 -0000 Received: from cluster-d.mailcontrol.com (HELO rly31d.srv.mailcontrol.com) (217.69.20.190) by a.mx.sunsite.dk with SMTP; 6 Jan 2006 10:38:51 -0000 Received: from exchange03.csr.com (uuk202166.uk.customer.alter.net [62.189.241.194] (may be forged)) by rly31d.srv.mailcontrol.com (MailControl) with ESMTP id k06AcTCt020883 for ; Fri, 6 Jan 2006 10:38:46 GMT Received: from csr.com ([10.103.143.38]) by exchange03.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Fri, 6 Jan 2006 10:38:40 +0000 To: zsh-users@sunsite.dk Subject: Re: FW: Full path with ksh emulation In-reply-to: <200601060047.k060lU37023709@rly01c.srv.mailcontrol.com> References: <200601060047.k060lU37023709@rly01c.srv.mailcontrol.com> Comments: In-reply-to "Tony Hasler" message dated "Fri, 06 Jan 2006 00:47:16 +0000." Date: Fri, 06 Jan 2006 10:38:39 +0000 From: Peter Stephenson Message-ID: X-OriginalArrivalTime: 06 Jan 2006 10:38:40.0462 (UTC) FILETIME=[5BC076E0:01C612AD] Content-Type: text/plain MIME-Version: 1.0 X-Scanned-By: MailControl A-05-40-01 (www.mailcontrol.com) on 10.68.0.141 "Tony Hasler" wrote: > The bad news is that it didn't work. It tries to find the argument in > $PATH, but when "." isn't there it reverts to the builtin. When "." is in > the path you get an absolute path, but one with a "." in it. Only when the > absolute path of "." is in $PATH and is the first place with an executable > copy of the script does it seem to work. Ah. You're right. > if [[ $(builtin whence $1) == .* ]]; then That looks good enough. You can optimise out the subprocess by changing this to if [[ $1 == .* || $(builtin whence $1) == .* ]]; then the point being that in your case, where . isn't part of the path, you are actually relying on the . being part of $1, so you never need the code in the $(...). You could probably change the patterns to (.|..)/* (as we're in zsh-specific land) for a little extra safety but it doesn't make much difference unless you have files starting with ".". -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 Your mail client is unable to display the latest news from CSR. To access our news copy this link into a web browser: http://www.csr.com/email_sig.html