Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: how to?
- X-seq: zsh-users 5283
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>
- To: Phil Pennock <Phil.Pennock@xxxxxxxxxxx>, zsh-users@xxxxxxxxxx
- Subject: Re: how to?
- Date: Sun, 25 Aug 2002 05:27:26 +0000
- In-reply-to: <20020824235610.A94@xxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20020823133510.2B8EC5B5@xxxxxxxxxx> <1020823155954.ZM21819@xxxxxxxxxxxxxxxxxxxxxxx> <20020823202218.A13113@xxxxxxxxxxx> <1020824034700.ZM22554@xxxxxxxxxxxxxxxxxxxxxxx> <20020824235610.A94@xxxxxxxxxxx>
On Aug 24, 11:56pm, Phil Pennock wrote:
}
} I didn't CC the list but instead made it a private reply. Sorry for any
} offense caused -- I see that I didn't tone my wording well.
Oh, dear. I completely missed that your message wasn't Cc'd to the list;
I thought I'd just accidentally hit "reply" instead of "replyall," so I
added the list back again. You didn't cause any offense, nor did I have
any complaint about your tone; and I certainly didn't intend for my reply
to give such an impression.
Well, as we're here already ...
} > } Which leads to a question: how much hassle is it to have a glob modifier
} > } be able to duplicate the Simple Command which is calling it?
} >
} > A glob modifier, just about impossible. A precommand modifier or option,
} > perhaps.
}
} Are there sufficient hooks to allow this to be done as a module?
Definitely not for the option route, but maybe for a something that works
like a precommand modifier -- or, really, just a special builtin that
chops up the argument list and calls argv[0] repeatedly with subsets.
The trouble, of course, is that it's very difficult to generalize, such
that you know which arguments have to be kept with argv[0] on every call
and which can be split across calls. You end up having to "invert" the
syntax, i.e., put the splittable args first, then some flag value (such
as "--"), and finally the command with its fixed args:
zargs **/*.c -- ls -l
That could actually be written as a shell function:
function zargs {
emulate -RL zsh
local command end=$argv[(i)--]
command=( $argv[end+1,-1] )
# Hmm: argv[end,-1]=() doesn't work ...
set -- $argv[1,end-1]
if ((ARGC == 0))
then $command
else
while ((ARGC))
do
for (( end=ARGC; ${(c)#argv[1,end]} > 20480; end/=2 )) :
$command $argv[1,end]
shift $end
done
fi
}
Aside to zsh-workers: "emulate -R" should not reset the XTRACE option,
but it does ...
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
Messages sorted by:
Reverse Date,
Date,
Thread,
Author