execute command in CURRENT shell

Grant Edwards grante at visi.com
Fri Aug 8 13:44:34 EDT 2003


In article <ec6d1a16.0308080828.367f6b54 at posting.google.com>, Valentine Kouznetsov wrote:

> simple question, how to execute command in current shell, not
> in subshell?

Can't be done.

> Example. I have environment variable A=aaa and need to invoke
> shell (sh) script which will do something with A. If I do
> os.system() then sub-shell will setup A and execute my script
> there leaving A in parent shell untouched.

Under Unix, you can't affect the environment of a parent.  You
can only write to your own environment and pass it on to your
children.

-- 
Grant Edwards                   grante             Yow!  It's OKAY --- I'm an
                                  at               INTELLECTUAL, too.
                               visi.com            




More information about the Python-list mailing list