From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6562 invoked from network); 10 Aug 2005 20:31:38 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 10 Aug 2005 20:31:38 -0000 Received: (qmail 31396 invoked from network); 10 Aug 2005 20:31:32 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 10 Aug 2005 20:31:32 -0000 Received: (qmail 29736 invoked by alias); 10 Aug 2005 20:31:25 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9284 Received: (qmail 29726 invoked from network); 10 Aug 2005 20:31:24 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 10 Aug 2005 20:31:24 -0000 Received: (qmail 30325 invoked from network); 10 Aug 2005 20:31:24 -0000 Received: from wproxy.gmail.com (64.233.184.204) by a.mx.sunsite.dk with SMTP; 10 Aug 2005 20:31:20 -0000 Received: by wproxy.gmail.com with SMTP id i2so222909wra for ; Wed, 10 Aug 2005 13:31:18 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=bddjR+RmOH/JAug0bUgJXg4oYeZBw2YjfFuTq9KDmzOXTHCnE0Qpl1zNojX2J3ZcOSr936anA4lzgknqTHBdb1Rmty5pDh+4lgxfiVB/Pi7CyMni00wdeNs12oHrBwEP4DR1Z4JAiq0hk4eqzFuYCAjcbEeu6mego949LoxXS3g= Received: by 10.54.34.33 with SMTP id h33mr717844wrh; Wed, 10 Aug 2005 13:31:18 -0700 (PDT) Received: by 10.54.81.7 with HTTP; Wed, 10 Aug 2005 13:31:18 -0700 (PDT) Message-ID: <7c737f3005081013313151c308@mail.gmail.com> Date: Wed, 10 Aug 2005 13:31:18 -0700 From: Deliverable Mail To: zsh-users@sunsite.dk Subject: Re: rm nonexisting*; alias with parameters? In-Reply-To: <20050810200620.E765C8633@pwstephenson.fsnet.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <7c737f3005081012187ed74a81@mail.gmail.com> <20050810200620.E765C8633@pwstephenson.fsnet.co.uk> X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,RCVD_BY_IP autolearn=ham version=3.0.4 Thanks, Peter! (I hear you, Ligesh... will do later :) Worked as described. Making rm -f does not change zsh behavior, of course, as globbing happens before -f can kick in -- so it's a bit confusing that -f doesn't work. Thankfully zsh says zsh: before its globbing error.=20 It's a tricky fault for those who expect rm -f to shut up and do it... Alexy On 8/10/05, Peter Stephenson wrote: > Deliverable Mail wrote: > > I have a log directory where different logs appear, and an alias to > > clear it up. I try to define patterns covering all the logs to avoid > > rm *, which is dangerous and asks for a confirmation. So I define all > > possible patterns like in an alias, rml: > > > > alias rml=3D'rm prefix1.* *.suffix2*' > > > > But when some of the patterns match nothing, zsh prints an error about > > that doesn't do anything. How can I change that behavior to the > > expected of rm -f ? >=20 > (Did you miss the -f after the rm? That confused me to begin with but > I'll assume so. The shell can't make rm look like rm -f.) >=20 > I think what you want is that if some patterns *do* match, the ones that > don't are silently removed. The neatest way of doing this is "setopt > cshnullglob", which uses the csh method: if no patterns match, the > shell reports an error, whereas if some do, the others are removed. If > you never want the shell error, "setopt nullglob". >=20 > > While I'm on the subject of aliases, looks like zsh aliases are as > > weak as bash's, so when I have my lr: > > > > alias lr=3D'ls -lt | head' > > > > which I could not use with a parameter, lr , I still cannot use a > > parameter in zsh. In bash, made lr a function -- what the zsh > > function would look like? >=20 > The same, probably. >=20 > lr() { > ls -lt "$@" | head > } >=20 > > And is there a way to do it in an alias, or still not? >=20 > No, functions are the right way. This is exactly what they're for. >=20 > -- > Peter Stephenson > Work: pws@csr.com > Web: http://www.pwstephenson.fsnet.co.uk >