Zsh Mailing List Archive
Messages sorted by:
Re: Tip of the day: previous command output
- X-seq: zsh-users 7892
- From: Andy Spiegl <zsh.Andy@xxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Tip of the day: previous command output
- Date: Fri, 20 Aug 2004 11:30:44 +0200
- In-reply-to: <Pine.LNX.4.61.0408190956440.9464@xxxxxxxxxxxxxxxxxx>
- Kinfo: virscan ok
- Kinfo: NoRelay, NoSpam
- Kreccount: 1
- Mail-followup-to: zsh-users@xxxxxxxxxx
- 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>
> Unless you also dropped the alias that prefixes keep with noglob, you
> still need $~*
Oops, I thought the ~ is only needed to make sure $* is treated as a
pattern? Hm, but on the other hand...yes you are right, I _do_ want zsh to
expand the globs before executing the command. Oh boy, I still have so
much to learn about zsh. It's so wonderfully powerful but also pretty
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? But the result should be the same or not?
> > So that I can do
> > keep locate -i pictures | grep -i thursday | grep -i png
> I don't know whether you intended this, but [with your original edit]
> that's equivalent to
> kept=$(locate -i pictures)
> print -Rc - $kept | grep -i thursday | grep -i png
Oooops again. Thanks for pointing that out!
But still strange that $kept is empty afterwards!
> whereas I would guess that, rather, you meant
> kept=( $(locate -i pictures | grep -i thursday | grep -i png) )
Yes, you are right of course.
Hm, wouldn't it be a nice feature in general to have zsh always remember
the output of the last command, i.e. an automagic "keep"? I suppose that
many zsh user do what I do frequently: execute something and the execute it
again only to append more options like grep, cut, awk etc. Would that be
very hard to implement? Or are there other drawbacks like more memory
usage because some commands might have _a lot_ of output? Hm, maybe it
should be done with a global size limit to avoid the latter problem.
Well, if that's not possible I'll use your alternative suggestion together
with a global alias "K" that I can simply append to a command line.
Thanks for your great help!
o _ _ _
------- __o __o /\_ _ \\o (_)\__/o (_) -o)
----- _`\<,_ _`\<,_ _>(_) (_)/<_ \_| \ _|/' \/ /\\
---- (_)/ (_) (_)/ (_) (_) (_) (_) (_)' _\o_ _\_v
Bad or missing mouse driver. Spank the cat? (Y/N)
Messages sorted by: