[ale] How to pass vars to lots of shell scripts?
Jim Kinney
jim.kinney at gmail.com
Fri Oct 18 14:12:35 EDT 2013
Depends on how the other scripts look for the vars. If they are looking for
command line args, then passing env vars won't work.
You can look for cli args first then env args as a fallback (or the other
way around).
I prefer to explicitly pass args (um, actually depends on number of args)
by either cli or file. It's faster to use env but for some reason I rarely
use it.
Often I use name=value pairs for when I have many args to handle.
On Fri, Oct 18, 2013 at 12:01 PM, leam hall <leamhall at gmail.com> wrote:
> Hey all,
>
> I have a master script that calls a couple hundred other scripts. Each of
> the "other" scripts can also be called in their own.
>
> What I'm thinking about is having a variable like "test" or "fix" be set,
> so that if the "other" scripts run they will get a parameter without me
> having to put a getopts stanza in each script.
>
> So maybe:
>
> . ./my_vars
> if [ $TEST ]
> then
> ...
>
> or
>
> if [ -f ./TEST ]
> then
> ...
>
> Thoughts on the best way to do this? I'm not saying my ideas are the only
> way, just what comes to mind.
>
> Leam
>
>
> --
> Mind on a Mission <http://leamhall.blogspot.com/>
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
>
>
--
--
James P. Kinney III
*
*Every time you stop a school, you will have to build a jail. What you gain
at one end you lose at the other. It's like feeding a dog on his own tail.
It won't fatten the dog.
- Speech 11/23/1900 Mark Twain
*
http://heretothereideas.blogspot.com/
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ale.org/pipermail/ale/attachments/20131018/50a2da42/attachment.html>
More information about the Ale
mailing list