From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23201 invoked from network); 21 Aug 2004 17:09:41 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 21 Aug 2004 17:09:41 -0000 Received: (qmail 5627 invoked from network); 21 Aug 2004 17:09:33 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 21 Aug 2004 17:09:33 -0000 Received: (qmail 16926 invoked by alias); 21 Aug 2004 17:08:25 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7900 Received: (qmail 16902 invoked from network); 21 Aug 2004 17:08:25 -0000 Received: from unknown (HELO a.mx.sunsite.dk) (130.225.247.88) by 130.225.247.90 with SMTP; 21 Aug 2004 17:08:25 -0000 Received: (qmail 2711 invoked from network); 21 Aug 2004 17:06:26 -0000 Received: from unknown (HELO moonbase.zanshin.com) (167.160.213.139) by a.mx.sunsite.dk with SMTP; 21 Aug 2004 17:06:24 -0000 Received: from toltec.zanshin.com (toltec.zanshin.com [64.84.47.166]) by moonbase.zanshin.com (8.12.11/8.12.11) with ESMTP id i7LH6McA028045 for ; Sat, 21 Aug 2004 10:06:22 -0700 Date: Sat, 21 Aug 2004 10:06:22 -0700 (PDT) From: Bart Schaefer Reply-To: zsh-users@sunsite.dk To: zsh-users@sunsite.dk Subject: Re: Tip of the day: previous command output In-Reply-To: Message-ID: References: <20040819085812.GL22962@localhost> <20040819164250.GA21575@spiegl.de> <20040820121202.GA31466@spiegl.de> <20040820145032.GH13530@ay.vinc17.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=-1.4 required=6.0 tests=BAYES_20 autolearn=no version=2.63 X-Spam-Hits: -1.4 On Fri, 20 Aug 2004, Bart Schaefer wrote: > On Fri, 20 Aug 2004, Andy Spiegl wrote: > > > What would be the difference if I dropped alias with the noglob and used > > $* instead of $~*? I guess zsh would expand the globs before calling > > the function, right? > > Right. > > > But the result should be the same or not? > > Should be the same. Waiting to expand uses a little less memory. I just thought of another difference ... and remembered the reason that I did it the way I did. Recall: keep () { kept=() # Erase old value in case of error on next line kept=($~*) print -Rc - $kept } Without the noglob, and if you use the NO_MATCH or CSH_NULL_GLOB setopts, which I do, then globbing errors occur before the function is called, and thus prevent the function from being called. With the noglob alias, the globbing error occurs inside the function, at the second assignment. The distinction is that in the latter case the prevous value of kept is erased on a globbing error, whereas in the former case it retains its old value. I find that having kept set to empty on a glob failure is more useful, but you may prefer otherwise.