Zsh Mailing List Archive
Messages sorted by:
Re: iterating through a hierarchy with a filter
- X-seq: zsh-users 12786
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: iterating through a hierarchy with a filter
- Date: Tue, 15 Apr 2008 10:51:14 +0100
- In-reply-to: <20080414233353.GW1223@xxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Organization: CSR
- References: <8BAD0AA6-3B6F-4946-B636-6C16B56A944E@xxxxxxxxx> <200804100851.m3A8pk9S003521@xxxxxxxxxxxxxx> <DDABD6BC-F3D9-4277-86C1-776B24CB914F@xxxxxxxxx> <20080410105245.GB11585@xxxxxxxxxxxx> <20080410114214.GB5179@xxxxxxxxxxxxxxx> <4531F8C0-94EB-4803-A31F-3B961164C885@xxxxxxxxx> <20080414233353.GW1223@xxxxxxxxxxxxxxxxxxx>
On Tue, 15 Apr 2008 01:33:53 +0200
Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
> On 2008-04-14 14:39:25 -0700, Alexy Khrabrov wrote:
> > If I give a single existing script as a parameter, it works fine. If,
> > however, I give it
> > walk 'iconv -f utf8 -t cp1251' srcdir tgtdir ...
> > -- I get "command not found" for 'iconv -f utf8 -t cp1251' at the line
> > above.
> You need to do sh word-splitting on $1 and make $filter an array:
> Alternatively, you can enable sh word-splitting globally.
That should work fine in this case.
More generally, I would be inclined to take the attitude that the argument
to your script is a complete command line in itself. In that case, the
logical thing to do is to "eval" the variable that contains it. That means
that you can put anything there you would in a normal zsh command line. If
you want the command to be executed "at arm's length", put the eval inside
(eval $1) <input >output
I have a vague memory that the shell is smart enough only to fork once
if there's a single external command in the eval, but the mists of time may
be confusing me.
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
Messages sorted by: