programmatically manipulation environment variables of the calling shell

Diez B. Roggisch deets at nospam.web.de
Mon Mar 12 12:25:23 EDT 2007


Dennis Lee Bieber wrote:

> On Mon, 12 Mar 2007 12:33:58 +0200, "Maxim Veksler" <hq4ever at gmail.com>
> declaimed the following in comp.lang.python:
> 
>> Hello list,
>> 
>> I'm trying to write a python script that would allow me to manipulate
>> shell variables of the calling shell. I'm trying to write some logic
>> that would know to add LD_LIBRARY_PATH to the users environment.
>> 
>> In bash this is done with "export", can I do this with python? (If at
>> all possible because python is actually a sub process of bash).
>>
> "calling shell"... Only OS I've encountered that allowed for a form
> of that was AmigaOS, which differentiated between "shell specific"
> (local) environment variables:
> 
> set lev "A Local Environment Variable"
> 
> and "system-wide" (global) ones:
> 
> setenv gev "Global Stuff"
> 
> The latter statement creates a file "env:gev" with "Global Stuff" as
> the contents ("env:" was a logical name for a system environment
> directory -- sys:env/ where sys: was a logical for the boot drive).
> 
> As files, system environment variables could be manipulated by
> almost anything...

Lacking memory protection, actually anything of anything could me
manipulated... and it was a _great_ OS, really loved it!

Diez



More information about the Python-list mailing list