Related Entries

Managing notes and todos
Excel to record expenses
Lean Pivot Tables
Can you spot the difference?
US Modem in India

« Stuff yet to be fixed

Printer-friendly

Leo script to generate environment setters

Convert property files into environment setting shell or batch scripts.

Leo Outliner is a fantastic outliner that can be used as a plain outliner or as a literate programming editor. If you are into Python scripting, you can easily extend it to make quick utilities. Here is one such silly script.

Often, I will need to set environment variables in DOS, Unix/Cygwin environments. I end up creating scripts to do this. However, it is quite painful to have one script with commands starting with export (for bash) and set (for DOS). Most of the time I would rather like to have a simple property file - like key=value in each line - that I can use to set the environment variables.

Download this Leo file. It has a script in one of the nodes. You put your property file in child nodes with @url node types. Then, when you run the script, each such child node is taken and written out as batch file or shell script as identified by the node header text. A silly little solution that took 5 minutes and has already taken lot of pains out for me!