I am on ubuntu 13.04, bash, python2.7.4
The interpreter doesn\'t see variables I set.
Here is an example:
$ echo $A
5
$ pyth
Aha! the solution is simple!
I was setting variables with plain $ A=5 command; when you use $ export B="kkk" everything is fine.
That is because export makes the variable available to sub-processes:
environment of the shellenvironment is passed to sub-processes of the shell.Plain $ A="kkk" just creates variables in the shell and doesn't do anything with the environment.
The interpreter called from the shell obtains it's environment from the parent -- the shell. So really the variable should be exported into the environment before.
Those variables (parameters in bash terminology) are not environment variables. You want to export them into the environment, using export or declare -x. See the bash documentation on environment.