From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9572 invoked from network); 18 Sep 2006 17:23:50 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.5 (2006-08-29) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO autolearn=ham version=3.1.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 18 Sep 2006 17:23:50 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 36329 invoked from network); 18 Sep 2006 17:23:43 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 18 Sep 2006 17:23:43 -0000 Received: (qmail 12645 invoked by alias); 18 Sep 2006 17:23:35 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10736 Received: (qmail 12633 invoked from network); 18 Sep 2006 17:23:35 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 18 Sep 2006 17:23:35 -0000 Received: (qmail 34976 invoked from network); 18 Sep 2006 17:23:35 -0000 Received: from p54852b3b.dip0.t-ipconnect.de (HELO localhost) (84.133.43.59) by a.mx.sunsite.dk with SMTP; 18 Sep 2006 17:23:32 -0000 Received: from localhost ([127.0.0.1]) by localhost with esmtp (Exim 4.60) (envelope-from ) id 1GPMqB-00012h-1o; Mon, 18 Sep 2006 19:23:31 +0200 Date: Mon, 18 Sep 2006 19:23:30 +0200 (CEST) Message-Id: <20060918.192330.29569625.Meino.Cramer@gmx.de> To: Stephane_Chazelas@yahoo.fr Cc: zsh-users@sunsite.dk Subject: Re: OT: How to list all but the last item From: Meino Christian Cramer In-Reply-To: <20060918171752.GA4980@sc> References: <20060918.183959.74746293.Meino.Cramer@gmx.de> <20060918171752.GA4980@sc> X-Mailer: Mew version 5.1 on Emacs 21.4 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable From: Stephane Chazelas Subject: Re: OT: How to list all but the last item Date: Mon, 18 Sep 2006 18:17:52 +0100 > On Mon, Sep 18, 2006 at 06:39:59PM +0200, Meino Christian Cramer wrot= e: > > Hi, > > = > > may be this is a very stupid question...and may be I am blind... > > But... > > = > > I want to contruct a loop like > > = > > for i in `` > > do > > ${i} > > done > > = > > and should return a list of items matched by a regexp > > or another kind of qualifier and skipping the last item. > > = > > Example: > > = > > ls -rtlc * | > > = > > would return every item in a directory exept the newest one. > = > -c is to sort of the file change-status time. You want file > modification time, it's ls -rtl. > = > And it should be > = > ls -rtl | ... > = > Or > = > ls -rtld -- * | ... > = > > Is there any way to accomplish with something fitting in on > > a commandline??? > = > ls -tl | tail +2 > = > ls -trl | sed '$d' > = > Also: > = > ls -trld -- *(om[2,-1]) > = > Also: > = > IFS=3D$'\n\n' > lines=3D( $(cmd) ) > for line in "${(@)lines[1,-2]}"; do ...; done > = > -- = > St=E9phane > = Hi Stephane, thanks a lot for your reply! :) = Now I have many solutions to choose from :)) Keep hacking! mcc