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

Re: Factoring out code



On Sep 6, 12:37pm, DervishD wrote:
}
}     So, how can I make a function to use the *global* argv and not
} the local one? Can a function modify the global argv?

You can't, and no.

The only thing you could do would be to establish a convention, such
as the one with reply/REPLY, and always remember to "set -- $reply"
after calling one of those functions.

If you don't like using eval on a variable that contains a code
fragment, how about using a set of aliases?  Each alias would "run
like [it] was cut ... and pasted into the file, just like a macro."
Your scripts would still end up looking more like the example with
multiple dot-commands, but you can put all the alias definitions
in one file.



Messages sorted by: Reverse Date, Date, Thread, Author