5

I tried to create an environment variable in my ~/.bashrc file as follows:

export DJANGO_DEVELOPMENT=true

After doing some troubleshooting it appears bash isn't picking up the new environment variable at all. I tried setting it in ~/profile but that hasn't worked either. (I edited both files under sudo) What am I doing wrong?

Brian Lee
  • 149

2 Answers2

3

Editing the file is not enough. You need to source that file. This is done usually when you start bash, but if you edited the file, you can force to read the file with:

source ~/.bashrc

Note: some systems could restrict what file is parsed at start of bash (e.g. if the file is writable by "other", or just different requiring different files, but AFAIK it is not often done, but on special devices)

EDIT:

You wrote that you edited the file with sudo. this could be a problem: if your user cannot read that file, the file is ignored. .bashrc is read as your user. But also this should not be a normal case: the files should already exists, and only bad editors will change permission of edited file.

-3

Answer: I forgot to put true in quotes.

Brian Lee
  • 149