parse an environment file

Chris Angelico rosuav at gmail.com
Wed Oct 3 00:03:59 EDT 2012


On Wed, Oct 3, 2012 at 1:49 PM, Jason Friedman <jason at powerpull.net> wrote:
> Based on your responses and everyone's responses I'm guessing that
> what I am doing is sufficiently novel that there is no canned
> solution.  I looked at shlex but did not see how that would be
> helpful.

The only canned solution for parsing a bash script is bash. Think
about it the other way around: If you wanted to have a Python variable
made available to a bash script, the obvious thing to do is to invoke
Python. It's the same thing.

I recommend going with Hans Mulder's suggestion of a wrapper script;
that seems to be the cleanest option available.

ChrisA



More information about the Python-list mailing list