From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12397 invoked from network); 20 Aug 2004 09:59:45 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 20 Aug 2004 09:59:45 -0000 Received: (qmail 24733 invoked from network); 20 Aug 2004 09:59:40 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 20 Aug 2004 09:59:40 -0000 Received: (qmail 7445 invoked by alias); 20 Aug 2004 09:32:15 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7892 Received: (qmail 7435 invoked from network); 20 Aug 2004 09:32:14 -0000 Received: from unknown (HELO a.mx.sunsite.dk) (130.225.247.88) by 130.225.247.90 with SMTP; 20 Aug 2004 09:32:14 -0000 Received: (qmail 94032 invoked from network); 20 Aug 2004 09:31:08 -0000 Received: from lyta.akte.de (217.160.134.217) by a.mx.sunsite.dk with SMTP; 20 Aug 2004 09:31:06 -0000 Received: (root@lyta.akte.de) by lyta.akte.de id ; Fri, 20 Aug 2004 11:30:55 +0200 KRecCount: 1 KInfo: virscan ok KInfo: NoRelay, NoSpam Received: from condor.int.spiegl.de (pD9E93F84.dip.t-dialin.net [217.233.63.132]) by lyta.akte.de via kasmail (2.9) id ; Fri, 20 Aug 2004 09:30:48 GMT Received: from condor.int.spiegl.de (spiegl@localhost [127.0.0.1]) by condor.int.spiegl.de (8.12.11.Beta0/8.12.11.Beta0/Debian-1) with ESMTP id i7K9UiWZ010307 for ; Fri, 20 Aug 2004 11:30:44 +0200 Received: (from spiegl@localhost) by condor.int.spiegl.de (8.12.11.Beta0/8.12.11.Beta0/Debian-1) id i7K9UiW9010305 for zsh-users@sunsite.dk; Fri, 20 Aug 2004 11:30:44 +0200 X-Authentication-Warning: condor.int.spiegl.de: spiegl set sender to zsh.Andy@spiegl.de using -f Date: Fri, 20 Aug 2004 11:30:44 +0200 From: Andy Spiegl To: zsh-users@sunsite.dk Subject: Re: Tip of the day: previous command output Message-ID: <20040820093044.GA8488@spiegl.de> Mail-Followup-To: zsh-users@sunsite.dk References: <20040819085812.GL22962@localhost> <20040819164250.GA21575@spiegl.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-PGP-GPG-Keys: mail -s "send pgp" auto@spiegl.de X-Accepted-File-Formats: ASCII .rtf .ps .pdf - *NO* MS Office files please. X-why-you-shouldnt-use-MS-LookOut: http://www.jensbenecke.de/l-oe-en.php X-warum-man-MS-Outlook-vermeiden-sollte: http://www.jensbenecke.de/l-oe-de.php X-Message-Flag: LookOut! You are using an insecure mail reader which can be used to spread viruses. User-Agent: Mutt/1.5.5.1+cvs20040105i X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: ** X-Spam-Status: No, hits=2.2 required=6.0 tests=BAYES_10,RCVD_IN_DSBL, RCVD_IN_NJABL,RCVD_IN_SORBS autolearn=no version=2.63 X-Spam-Hits: 2.2 > 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 complex. 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! Andy. -- o _ _ _ ------- __o __o /\_ _ \\o (_)\__/o (_) -o) ----- _`\<,_ _`\<,_ _>(_) (_)/<_ \_| \ _|/' \/ /\\ ---- (_)/ (_) (_)/ (_) (_) (_) (_) (_)' _\o_ _\_v ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Bad or missing mouse driver. Spank the cat? (Y/N)