[Tutor] Replacing "source" in Bash Scripting

James jtp at nc.rr.com
Fri Sep 28 16:02:46 CEST 2007


Hi.

I'm re-writing a rather complex bash script I've been using for years  
in Python.  The bash script uses a relatively simple configuration  
file in order to get pertinent information before it runs.  The  
configuration file is relatively simple: about 30 variables are  
defined in this manner in the config file:

VARNAME=value

In the bash script I simply "source" this configuration file and the  
script runs merrily using those variables defined in the  
configuration file.  i.e.,

"source configFile"

I'm trying to implement similar behavior in a Python script,  
specifically having a configuration file (with a list of variables  
and their values defined) that my Python program will read once  
running.  I'm not really sure what the best way to implement this is.

Ideas?

Thanks!
.james


More information about the Tutor mailing list