Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Tip of the day: previous command output
- X-seq: zsh-users 7900
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Tip of the day: previous command output
- Date: Sat, 21 Aug 2004 10:06:22 -0700 (PDT)
- In-reply-to: <Pine.LNX.4.61.0408200905300.27591@xxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20040819085812.GL22962@localhost> <Pine.LNX.4.61.0408190748530.9464@xxxxxxxxxxxxxxxxxx> <20040819164250.GA21575@xxxxxxxxx> <Pine.LNX.4.61.0408190956440.9464@xxxxxxxxxxxxxxxxxx> <20040820121202.GA31466@xxxxxxxxx> <20040820145032.GH13530@xxxxxxxxxxxxx> <Pine.LNX.4.61.0408200905300.27591@xxxxxxxxxxxxxxxxxx>
- Reply-to: zsh-users@xxxxxxxxxx
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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author