From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29620 invoked from network); 31 Oct 2006 02:54:48 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) 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.7 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 31 Oct 2006 02:54:48 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 56568 invoked from network); 31 Oct 2006 02:54:42 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 31 Oct 2006 02:54:42 -0000 Received: (qmail 10263 invoked by alias); 31 Oct 2006 02:54:35 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 22932 Received: (qmail 10254 invoked from network); 31 Oct 2006 02:54:34 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 31 Oct 2006 02:54:34 -0000 Received: (qmail 55927 invoked from network); 31 Oct 2006 02:54:34 -0000 Received: from vms046pub.verizon.net (206.46.252.46) by a.mx.sunsite.dk with SMTP; 31 Oct 2006 02:54:33 -0000 Received: from torch.brasslantern.com ([71.116.118.106]) by vms046.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0J7Z00HMPC2AO4K1@vms046.mailsrvcs.net> for zsh-workers@sunsite.dk; Mon, 30 Oct 2006 20:54:11 -0600 (CST) Received: from torch.brasslantern.com (localhost.localdomain [127.0.0.1]) by torch.brasslantern.com (8.13.1/8.13.1) with ESMTP id k9V2s9bE009986 for ; Mon, 30 Oct 2006 18:54:10 -0800 Received: (from schaefer@localhost) by torch.brasslantern.com (8.13.1/8.13.1/Submit) id k9V2s93Z009985 for zsh-workers@sunsite.dk; Mon, 30 Oct 2006 18:54:09 -0800 Date: Mon, 30 Oct 2006 18:54:07 -0800 From: Bart Schaefer Subject: Re: Prepend/append to the members of a list In-reply-to: =?iso-8859-1?Q?=3C20061030170919=2EGA9507=40alea=2Egnuu=2Ede?= =?iso-8859-1?Q?=3E?= =?iso-8859-1?Q?Comments=3A_In_reply_to_J=F6rg_Sommer_=3Cjoerg=40alea=2Egn?= =?iso-8859-1?Q?uu=2Ede=3E?= =?iso-8859-1?Q?________=22Prepend=2Fappend_to_the_members_of_a_list=22_?= =?iso-8859-1?Q?=28Oct_30=2C__6=3A09pm=29?= To: zsh-workers@sunsite.dk Message-id: <061030185409.ZM9982@torch.brasslantern.com> MIME-version: 1.0 X-Mailer: OpenZMail Classic (0.9.2 24April2005) Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: quoted-printable References: <20061030170919.GA9507@alea.gnuu.de> On Oct 30, 6:09pm, J=F6rg Sommer wrote: } } % ls !ls*:(s/^/dir/) }=20 } But it does not work, because the s/// expression doesn't know ^. Even if history substitution did understand beginning-of-word, that still wouldn't work. You'd at the least need :gs and some character other than slash as the separator. Usually in this situation I would do something like % (cd dir; !ls ) Nikolai's suggestion can be tweaked to not require rcexpandparam: % a=3D( !ls:* ); ls dir/$^a Or this: % ls dir/${^$(echo !{ls:*:q})} } Or another example: }=20 } % cp dir/*.[1-9](:t:s+^+/usr/share/man/man?/+:s/$/.gz/) . There you're in a bit of a pickle because you're using history modifiers on a glob pattern, which is even more limited. I believe the closest you'd get without pain [#] is: % cp /usr/share/man/man?/${^$(echo dir/*.[1-9](:t)}.gz . which isn't that much uglier than what you constructed. Of course, if you do this specific thing often you can do % function mangz { reply=3D(/usr/share/man/man?/$REPLY:t.gz) } % cp dir/*.[1-9](+mangz) . [#] Pain is safely quoting special characters in the file name: % cp /usr/share/man/man?/${^$(echo dir/*.[1-9](:te.'reply=3D${(q)REPLY}'.))= }.gz . --=20