From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12275 invoked from network); 24 Sep 2003 13:59:02 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 24 Sep 2003 13:59:02 -0000 Received: (qmail 29876 invoked by alias); 24 Sep 2003 13:58:56 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 19131 Received: (qmail 29866 invoked from network); 24 Sep 2003 13:58:56 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 24 Sep 2003 13:58:56 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [217.174.194.138] by sunsite.dk (MessageWall 1.0.8) with SMTP; 24 Sep 2003 13:58:56 -0000 Received: from DervishD.pleyades.net (212.Red-80-35-44.pooles.rima-tde.net [80.35.44.212]) by madrid10.amenworld.com (8.10.2/8.10.2) with ESMTP id h8ODwkw25061; Wed, 24 Sep 2003 15:58:46 +0200 Received: from raul@pleyades.net by DervishD.pleyades.net with local (Exim MTA 2.05) id <1A2ACg-00011r-00>; Wed, 24 Sep 2003 16:01:14 +0200 Date: Wed, 24 Sep 2003 16:01:14 +0200 From: DervishD To: Bart Schaefer Cc: Zsh Subject: Re: Would this (o) be very difficult to add? Message-ID: <20030924140114.GC411@DervishD> Mail-Followup-To: Bart Schaefer , Zsh References: <20030923161213.GA772@DervishD> <1030923165535.ZM29098@candle.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1030923165535.ZM29098@candle.brasslantern.com> User-Agent: Mutt/1.4i Organization: Pleyades User-Agent: Mutt/1.4i Hi Bart :) * Bart Schaefer dixit: > } Sometimes we want to do globbing and sort the output randomly: > } when generating playlists, when generating image slideshows, etc... > Try this: > print -lP *(e:'REPLY=%0(l..$RANDOM)"$REPLY"':) Very clever, I'd never have thought about something like that... I tried something like this, inserting $RANDOM before each filename in a for loop, redirecting to sort (or using the (o) modifier to sort the list by name) and using cut (or ${...##...}) for getting rid of the random number. No doubt your example is better. Far better ;)) Anyway I keep thinking that the (or) modifier would be useful ;) Thanks a lot for your answer. It's a neat, short and fast way of generating random lists :))) Raúl Núñez de Arenas Coronado -- Linux Registered User 88736 http://www.pleyades.net & http://raul.pleyades.net/