From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25548 invoked by alias); 3 Jul 2012 10:23:22 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17167 Received: (qmail 19721 invoked from network); 3 Jul 2012 10:23:20 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,T_DKIM_INVALID,T_TO_NO_BRKTS_FREEMAIL autolearn=ham version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at spf.messagingengine.com designates 66.111.4.27 as permitted sender) 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= Message-Id: <1341310996.6679.140661097202637.0031FC7F@webmail.messagingengine.com> X-Sasl-Enc: BcOtWQe5As6jcf3KqrIfi97rAd9rj6DkR1g/dsj0gVhE 1341310996 From: Ronald Fischer To: zsh-users@zsh.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Mailer: MessagingEngine.com Webmail Interface Subject: Re: [MAYBE SOLVED] passing modified parameter list to child Date: Tue, 03 Jul 2012 12:23:16 +0200 >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 + 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)