Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [MAYBE SOLVED] passing modified parameter list to child



>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