Category Archives : scripting

Python – importing bash environment variables

I’ve run into situations where it was necessary to read the values of bash environment variables defined in a file into a python script. Something like that is achieved in bash simply by doing: source env.vars or . env.vars Where the content of env.vars could be something like this: BASE=/home/user/scripts BIN_DIR=$BASE/bin VAR1=xxxxx VAR2=yyyy The solutions […]

Perl Config::General setup and usage

Few libraries have been as useful to me over the years as Perl’s Config::General. It gives us a simple way to create configurable scripts with minimal code, in a syntax-light configuration file format. The configuration file format is similar to apache’s, and the module can parse native apache configuration files. How to start using it: use Config::General; […]