From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8340 invoked from network); 1 Jun 2007 10:31:16 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=no version=3.2.0 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 1 Jun 2007 10:31:16 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 12254 invoked from network); 1 Jun 2007 10:31:08 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 1 Jun 2007 10:31:08 -0000 Received: (qmail 9510 invoked by alias); 1 Jun 2007 10:31:05 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 23505 Received: (qmail 9501 invoked from network); 1 Jun 2007 10:31:04 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 1 Jun 2007 10:31:04 -0000 Received: (qmail 11946 invoked from network); 1 Jun 2007 10:31:04 -0000 Received: from cluster-c.mailcontrol.com (168.143.177.190) by a.mx.sunsite.dk with SMTP; 1 Jun 2007 10:31:01 -0000 Received: from cameurexb01.EUROPE.ROOT.PRI ([62.189.241.200]) by rly06c.srv.mailcontrol.com (MailControl) with ESMTP id l51AT1Kx000437 for ; Fri, 1 Jun 2007 11:30:56 +0100 Received: from news01.csr.com ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.1830); Fri, 1 Jun 2007 11:29:35 +0100 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.13.8/8.13.4) with ESMTP id l51ATZFI008616 for ; Fri, 1 Jun 2007 11:29:35 +0100 Received: from csr.com (pws@localhost) by news01.csr.com (8.13.8/8.13.8/Submit) with ESMTP id l51ATZbo008613 for ; Fri, 1 Jun 2007 11:29:35 +0100 Message-Id: <200706011029.l51ATZbo008613@news01.csr.com> X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: Zsh-Workers Subject: Re: alias -s doesn't friendly deal with programs having an extension In-reply-to: <20070601095747.GA23444@finlandia.home.infodrom.org> References: <20070601095747.GA23444@finlandia.home.infodrom.org> Comments: In-reply-to Maddi Kopfermann message dated "Fri, 01 Jun 2007 11:57:47 +0200." Date: Fri, 01 Jun 2007 11:29:35 +0100 From: Peter Stephenson X-OriginalArrivalTime: 01 Jun 2007 10:29:35.0869 (UTC) FILETIME=[C03C6AD0:01C7A437] Content-Type: text/plain MIME-Version: 1.0 X-Scanned-By: MailControl A-07-07-05 (www.mailcontrol.com) on 10.67.0.116 Maddi Kopfermann wrote: > Hi, ZSH workers, > > after alias pl=perl e.g. > a program with an extension like e.g. program.pl can no > longer be invoked without its full path. In the case of Perl, the fix is simple: alias -s pl='perl -S' (although the Perl documentation is now so complicated it took me five minutes to confirm that...) More generally, you could write a shell function to do this. pathfind() { local dir for dir in $path; do if [[ -f $dir/$2 ]]; then $1 $dir/$2 "${(@)argv[3,-1]}" return fi done print pathfind: file not found in path: $2 return 255 } alias -s pl='pathfind perl' -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php To get further information regarding CSR, please visit our Investor Relations page at http://ir.csr.com/csr/about/overview