On Wed, Nov 11, 2009 at 1:03 AM, Simon Wistow <si...@thegestalt.org> wrote:
> I have a small problem in that I'm trying to modify a bash script so
> that currently does this
>
>    . config
>    # then inspect command line args
>    getArgs
>
> so that you can specify the config file on the command line. Which
> necessarily requires do
>
>    config_file="config"
>    # inspect command line args first
>    getArgs
>    . ${config_file}

Perhaps I'm overlooking something obvious, but why don't you just parse twice?

Failing that, you could opt to use environment variables for extra
config files, so you'd call it like

MYSCRIPT_CONFIG_FILE=/path/to/config ./myscript.sh

That way you eliminate the first pass of the arguments.

--James

Reply via email to