Absolutely, but I think the point is that you can't exec that 'source' cmd
from inside your script,
if your goal is to change environment variables in the parent process (a
shell, here).
So if you're counting on a larger process, you'll might need some locking
mechanism,
if the rest of your script will be waiting for that change.

~ben


On Tue, Feb 26, 2008 at 11:43 AM, Fred James <[EMAIL PROTECTED]>
wrote:

> Rob Hudson wrote:
>
> >I've got some Python scripts that rely on shell environment variables
> >for certain things.  I wrote a simple script that did an export but it
> >didn't take, and I'm guessing that the shell script gets its own
> >environment, that when the script terminates goes away.
> >
> >Is there a way to write a shell script that can export an environment
> >variable to the calling shell?
> >
> >I know I can set environment variables in Python, but I want to keep
> >things modular so I can re-use the Python script and do things based
> >on different environment settings.
> >
> >Thanks,
> >Rob
> >
> >
> Rob Hudson
> Create a file the contents of which are in the form ...
>
> export ENV_VARIABLE1=value1
> export ENV_VARIABLE2=value2
> export ENV_VARIABLE3=value3
> export ENV_VARIABLE4=value4
>
> ... "source" the file as ...
>
> . filename
>
> (that is dot space filename)
> Hope this helps
> Regards
> Fred James
> _______________________________________________
> EUGLUG mailing list
> [email protected]
> http://www.euglug.org/mailman/listinfo/euglug
>
_______________________________________________
EUGLUG mailing list
[email protected]
http://www.euglug.org/mailman/listinfo/euglug

Reply via email to