Saturday, 28 September 2013

Accessing environment variables with the same name than bash variables

Accessing environment variables with the same name than bash variables

This outputs 1:
A=1; A=2 echo $A
While this outputs 2:
A=1; A=2 python2 -c 'import os; print os.environ["A"]'
In bash, is there any way to read the environment variable instead of the
bash variable without writing helper code (python, perl, etc)?

No comments:

Post a Comment