From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20839 invoked from network); 31 Jan 2005 16:47:47 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 31 Jan 2005 16:47:47 -0000 Received: (qmail 19497 invoked from network); 31 Jan 2005 16:47:40 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 31 Jan 2005 16:47:40 -0000 Received: (qmail 1857 invoked by alias); 31 Jan 2005 16:47:20 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8441 Received: (qmail 1844 invoked from network); 31 Jan 2005 16:47:20 -0000 Received: from unknown (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 31 Jan 2005 16:47:20 -0000 Received: (qmail 18152 invoked from network); 31 Jan 2005 16:46:44 -0000 Received: from out009pub.verizon.net (HELO out009.verizon.net) (206.46.170.131) by a.mx.sunsite.dk with SMTP; 31 Jan 2005 16:46:39 -0000 Received: from candle.brasslantern.com ([4.11.10.129]) by out009.verizon.net (InterMail vM.5.01.06.06 201-253-122-130-106-20030910) with ESMTP id <20050131164637.FTIO4172.out009.verizon.net@candle.brasslantern.com>; Mon, 31 Jan 2005 10:46:37 -0600 Received: from candle.brasslantern.com (IDENT:schaefer@localhost [127.0.0.1]) by candle.brasslantern.com (8.12.11/8.12.11) with ESMTP id j0VGkXit031320; Mon, 31 Jan 2005 08:46:33 -0800 Received: (from schaefer@localhost) by candle.brasslantern.com (8.12.11/8.12.11/Submit) id j0VGkXJ3031319; Mon, 31 Jan 2005 08:46:33 -0800 From: Bart Schaefer Message-Id: <1050131164632.ZM31318@candle.brasslantern.com> Date: Mon, 31 Jan 2005 16:46:32 +0000 In-Reply-To: <5ced8dfb84fe26e20350095da48dd44d@chemistry.ucsc.edu> Comments: In reply to William Scott "odd recursion" (Jan 31, 8:24am) References: <5ced8dfb84fe26e20350095da48dd44d@chemistry.ucsc.edu> X-Mailer: Z-Mail (5.0.0 30July97) To: William Scott , L:ZSH-users Subject: Re: odd recursion MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Authentication-Info: Submitted using SMTP AUTH at out009.verizon.net from [4.11.10.129] at Mon, 31 Jan 2005 10:46:33 -0600 X-Spam-Checker-Version: SpamAssassin 3.0.2 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, score=-2.6 required=6.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.2 X-Spam-Hits: -2.6 On Jan 31, 8:24am, William Scott wrote: } } I stumbled onto something that makes me realize there is a lot to zsh I } don't understand. I've resolved the problem, but I still don't } understand it. You stumbled on FAQ question number 2.3, "Why do my csh aliases not work? (Plus other alias pitfalls.)" There is one other serious problem with aliases: consider alias l='/bin/ls -F' l() { /bin/ls -la "$@" | more } `l' in the function definition is in command position and is expanded as an alias, defining `/bin/ls' and `-F' as functions which call `/bin/ls', which gets a bit recursive. This can be avoided if you use `function' to define a function, which doesn't expand aliases. It is possible to argue for extra warnings somewhere in this mess. Bart Schaefer's rule is: Define first those aliases you expect to use in the body of a function, but define the function first if the alias has the same name as the function.