Set an environment variable

Mike Meyer mwm at mired.org
Thu Oct 20 12:38:29 EDT 2005


"Eric Brunel" <eric_brunel at despammed.com> writes:
> -myScript.py--------------------------------------
> print 'export MY_VARIABLE=value'
> --------------------------------------------------
>
> -myScript.sh--------------------------------------
> python myScript.py > /tmp/chgvars.sh
> . /tmp/chgvars.sh

It's simpler to use eval and command substitution:

eval $(python myScript.py)

     <mike

-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list