Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [MAYBE SOLVED] passing modified parameter list to child
- X-seq: zsh-users 17167
- From: Ronald Fischer <ynnor@xxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: [MAYBE SOLVED] passing modified parameter list to child
- Date: Tue, 03 Jul 2012 12:23:16 +0200
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=mm.st; h=	message-id:from:to:mime-version:content-transfer-encoding	:content-type:subject:date; s=mesmtp; bh=KSDLFH0aMCFwwMXYOY0/TUM	SLkE=; b=CmCts+3WGfq6WCoZXsOM8mNzHWreYk8IyOK7q6O6yA2jWgNCQkjRIe2	V4En+LsjWH7jh2ff9lvI5UoZSQJlFd0pgVEoWnyWHHDlAGM1BfCgdRYx99eFG/8i	zQTFptdy6hpr+686d5uC//3QmNN/hHzjvmPR2PU7nf1+9sLviOSs=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=	messagingengine.com; h=message-id:from:to:mime-version	:content-transfer-encoding:content-type:subject:date; s=smtpout;	 bh=KSDLFH0aMCFwwMXYOY0/TUMSLkE=; b=q7xK8JLKljQAQa2h41hxcF4jxJpZ	L8a/aHE6BObgO1ZSMaTjcPeNKQkoYJirYlUwSFAE7g30y6vTnEGzmdzt96/utait	/w+JqFyiyQehJvndjfeyNzJ1Rqw3z5hZrrilouLf+1OyJ38mi2ztsRC5jUEQcK1F	p9zI8u1kfGlGiWI=
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
>For example, if the user calls
>  master --foo --bar=baz abcd
>this should be turned into
>  slave --foo --bar=baz --use=abcd
>but a call
>  master -x -y
>should just become
>  slave -x -y
I found the following approach, which already seems to be pretty
compact:
if [[ ${@[-1]:--} != -* ]] # If last argument is present, but does not
start with a dash
then
   argv[-1]=--use=${@[-1]}
fi
slave "$@"
In the cases I tested, this seemed to work well. If someone thinks that
my solution is flawed, or come out with a better one, I would be glad to
know.
Ronald
-- 
Ronald Fischer <ronaldf@xxxxxx>
+  If a packet hits a pocket on a socket on a port, 
+  and the bus is interrupted and the interrupt's not caught,
+  then the socket packet pocket has an error to report.
+		(cited after Peter van der Linden)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author