From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4113 invoked from network); 13 Aug 2005 21:49:13 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 13 Aug 2005 21:49:13 -0000 Received: (qmail 40089 invoked from network); 13 Aug 2005 21:49:05 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 13 Aug 2005 21:49:05 -0000 Received: (qmail 5694 invoked by alias); 13 Aug 2005 21:48:59 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9313 Received: (qmail 5684 invoked from network); 13 Aug 2005 21:48:59 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 13 Aug 2005 21:48:59 -0000 Received: (qmail 39212 invoked from network); 13 Aug 2005 21:48:59 -0000 Received: from ns9.hostinglmi.net (213.194.149.146) by a.mx.sunsite.dk with SMTP; 13 Aug 2005 21:48:52 -0000 Received: from 212.red-80-35-44.pooles.rima-tde.net ([80.35.44.212] helo=localhost) by ns9.hostinglmi.net with esmtpa (Exim 4.51) id 1E43s1-0007Bb-VN; Sat, 13 Aug 2005 23:48:50 +0200 Date: Sat, 13 Aug 2005 23:52:21 +0200 From: DervishD To: Bart Schaefer Cc: Zsh Users Subject: Re: Printing arrays for use with $() Message-ID: <20050813215221.GA296@DervishD> Mail-Followup-To: Bart Schaefer , Zsh Users References: <20050811222847.GA341@DervishD> <1050812022700.ZM12607@candle.brasslantern.com> <20050812082909.GB354@DervishD> <1050812143713.ZM13160@candle.brasslantern.com> <20050812145208.GA234@DervishD> <20050812143240.GA200@DervishD> <20050812145734.GB234@DervishD> <1050813013402.ZM13841@candle.brasslantern.com> <20050813082824.GA290@DervishD> <1050813185435.ZM18050@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: <1050813185435.ZM18050@candle.brasslantern.com> User-Agent: Mutt/1.4.2.1i Organization: DervishD X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - ns9.hostinglmi.net X-AntiAbuse: Original Domain - sunsite.dk X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [47 12] X-AntiAbuse: Sender Address Domain - dervishd.net X-Source: X-Source-Args: X-Source-Dir: 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.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.4 Hi Bart :) * Bart Schaefer dixit: > On Aug 13, 10:28am, DervishD wrote: > } > I still recommend "print -rN" here. > } Why? Just in case some file has a '\' sequence in its name, a > } quote or something like that? > Yep. OK. I finally used this solution, but added an option to the script so I can use '\0' or '\n' as the separator, and after that I've setup an alias: myalias='reply=( ${(f)"$(script)"} ) ; print -l $reply' This way I can use 'reply' for storing the list of files when the shell is interactive, and if I use 'script' within another script, I just write the above. I can use the script with the option of using NULL's as separator and pipe the output thru 'xargs' or the like. Thanks a lot for your invaluable help, Bart :)) In case anyone is interested, the script shuffles a list of MP3 files and chooses a set to fit some given size (for example, the space available in your MP3 player, a 74minutes CD, etc. I had it implemented as a couple of shell functions, but I needed to make it an script, that's why I made so much noise in the list. I'm going to release under GPL this and a few other scripts in some weeks, just in case someone wants to take a look. There is very good code in the scripts, but almost all of them came from the mind of Bart, so please bother him with the acknowledgements XDD Raúl Núñez de Arenas Coronado -- Linux Registered User 88736 | http://www.dervishd.net http://www.pleyades.net & http://www.gotesdelluna.net It's my PC and I'll cry if I want to...