How can I set environment variables depending on directory

Posted by kjs3 on Stack Overflow See other posts from Stack Overflow or by kjs3
Published on 2010-05-06T23:20:13Z Indexed on 2010/05/06 23:28 UTC
Read the original article Hit count: 229

Filed under:

If I have 'export BLA="hey there"' in .profile in my home directory, how can I change this later in other directories just by cd into the other directory? Also, is there a way to just set a new environment variable when I cd into a directory.

My first attempt was to just make another .bashrc file in the directory where I want the change but apparently that proved less than effective.

I'm on OS X btw.

© Stack Overflow or respective owner

Related posts about environment-variables