Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Tip of the day: previous command output

> 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: Reverse Date, Date, Thread, Author