From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2456 invoked from network); 27 Sep 2003 11:15:50 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 27 Sep 2003 11:15:50 -0000 Received: (qmail 10160 invoked by alias); 27 Sep 2003 11:15:43 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 19145 Received: (qmail 10140 invoked from network); 27 Sep 2003 11:15:43 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 27 Sep 2003 11:15:43 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [217.174.194.138] by sunsite.dk (MessageWall 1.0.8) with SMTP; 27 Sep 2003 11:15:43 -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 h8RBFeG15226; Sat, 27 Sep 2003 13:15:40 +0200 Received: from raul@pleyades.net by DervishD.pleyades.net with local (Exim MTA 2.05) id <1A3D5u-00005E-00>; Sat, 27 Sep 2003 13:18:34 +0200 Date: Sat, 27 Sep 2003 13:18:34 +0200 From: DervishD To: Bart Schaefer , Zsh Subject: Re: Would this (o) be very difficult to add? Message-ID: <20030927111834.GA277@DervishD> Mail-Followup-To: Bart Schaefer , Zsh References: <20030923161213.GA772@DervishD> <1030923165535.ZM29098@candle.brasslantern.com> <20030924140114.GC411@DervishD> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20030924140114.GC411@DervishD> User-Agent: Mutt/1.4i Organization: Pleyades User-Agent: Mutt/1.4i Hi Bart and zsh workers :)) * DervishD dixit: > * 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... This solution has worked great for generating, for example, a file containing the names of the files in random order. The problem is that I cannot use this in a command: command $(print -lP...) results in 'command file name 1 file name 2', unquoted :((( Strictly speaking, characters like '[' are quoted, but spaces arent, and the names which I want to order randomly usually contain spaces. I've tried something like 'array=($(print -lP...))', but since the expansion has spaces unquoted, the elements of the array end up being 'file', 'name', '2', 'file', 'name', '1', and so on. How can I get the result of the 'e' glob qualifier quoted, so I can use command $(print -lP...) and get a working command? Thanks a lot :)) Raúl Núñez de Arenas Coronado -- Linux Registered User 88736 http://www.pleyades.net & http://raul.pleyades.net/