Adding environment variables to bash.
Fredrik Lundh
fredrik at pythonware.com
Thu Sep 11 05:37:53 EDT 2008
John Lawrence wrote:
> You can make a command use the current shell though if you use the '.'
> command e.g.:
>
> jl > cat env.sh
> export TEST='hello'
>
> jl > ./env.sh && env | grep TEST #Doesn't set TEST in parent shell
> jl > . ./env.sh && env | grep TEST #Adding '. ' before the
> command uses the same shell
> TEST=hello
doesn't exactly work for Python scripts, though:
$ cat env.py
#!/usr/bin/env python
import os
os.environ["TEST"] = "hello"
$ . ./env.py && env | grep TEST
import: unable to open X server `'.
bash: os.environ[TEST]: command not found
</F>
More information about the Python-list
mailing list