From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2056 invoked from network); 30 Aug 2004 16:42:59 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 30 Aug 2004 16:42:59 -0000 Received: (qmail 44478 invoked from network); 30 Aug 2004 16:42:53 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 30 Aug 2004 16:42:53 -0000 Received: (qmail 4680 invoked by alias); 30 Aug 2004 16:41:42 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7946 Received: (qmail 4665 invoked from network); 30 Aug 2004 16:41:41 -0000 Received: from unknown (HELO a.mx.sunsite.dk) (130.225.247.88) by 130.225.247.90 with SMTP; 30 Aug 2004 16:41:41 -0000 Received: (qmail 39672 invoked from network); 30 Aug 2004 16:39:47 -0000 Received: from lyta.akte.de (217.160.134.217) by a.mx.sunsite.dk with SMTP; 30 Aug 2004 16:39:44 -0000 Received: (root@lyta.akte.de) by lyta.akte.de id ; Mon, 30 Aug 2004 18:39:31 +0200 KRecCount: 1 KInfo: virscan ok KInfo: NoRelay, NoSpam Received: from condor.int.spiegl.de (p54801171.dip.t-dialin.net [84.128.17.113]) by lyta.akte.de via kasmail (2.9) id ; Mon, 30 Aug 2004 16:39:28 GMT Received: from condor.int.spiegl.de (spiegl@localhost [127.0.0.1]) by condor.int.spiegl.de (8.12.11.Beta0/8.12.11.Beta0/Debian-1) with ESMTP id i7UGdPlQ009348 for ; Mon, 30 Aug 2004 18:39:25 +0200 Received: (from spiegl@localhost) by condor.int.spiegl.de (8.12.11.Beta0/8.12.11.Beta0/Debian-1) id i7UGdPIl009346 for zsh-users@sunsite.dk; Mon, 30 Aug 2004 18:39:25 +0200 X-Authentication-Warning: condor.int.spiegl.de: spiegl set sender to zsh.Andy@spiegl.de using -f Date: Mon, 30 Aug 2004 18:39:25 +0200 From: Andy Spiegl To: zsh-users@sunsite.dk Subject: Re: how to force scalar to be an array? Message-ID: <20040830163925.GB3639@spiegl.de> Mail-Followup-To: zsh-users@sunsite.dk References: <20040827154905.GA26846@spiegl.de> <20040828074355.GA4953@spiegl.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-PGP-GPG-Keys: mail -s "send pgp" auto@spiegl.de X-Accepted-File-Formats: ASCII .rtf .ps .pdf - *NO* MS Office files please. X-why-you-shouldnt-use-MS-LookOut: http://www.jensbenecke.de/l-oe-en.php X-warum-man-MS-Outlook-vermeiden-sollte: http://www.jensbenecke.de/l-oe-de.php X-Message-Flag: LookOut! You are using an insecure mail reader which can be used to spread viruses. User-Agent: Mutt/1.5.5.1+cvs20040105i X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=-0.0 required=6.0 tests=BAYES_44 autolearn=no version=2.63 X-Spam-Hits: -0.0 Hi Bart, > What I meant was: > > words=( $=result ) > print $words[1] Ah! Thanks so much once again for your help. > You can even do it in one expression: > > print ${${(A)=words::=$result}[1]} Cool. But hard to read. > You'd also think that the (@) flag would fix that, but it only > *preserves* array-ness in the transition from inner to outer nested > expansions, it doesn't *create* array-ness from a scalar. Yep, I did think that. So maybe your suggestion below would be worth discussion on zsh-workers. :-) > The latter might be something we could consider changing without much risk > of breaking anything. > You can do that latter one in zsh, too, if you have extendedglob set: > > : ${result//(#b)([^[:space:]]#)(*)/} > print -l $match[1] $match[2] Uffda, gotta go back and read more of the zsh manual. Thanks again, I really appreciate your help! Andy. -- o _ _ _ ------- __o __o /\_ _ \\o (_)\__/o (_) -o) ----- _`\<,_ _`\<,_ _>(_) (_)/<_ \_| \ _|/' \/ /\\ ---- (_)/ (_) (_)/ (_) (_) (_) (_) (_)' _\o_ _\_v ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Life is like a box of chocolates. You never know what you get. (Forrest Gump, 1994)