title: Directory based environment variable scope - how to implement?
body: <p>I have a set of tools which I need to pass parameters depending on the project I'm working on. I'd like to be able to automatically set a couple of environment variables based on the current directory. So when I switched between directories, my commonly used env vars would also change. Example:</p>
  
  <p>Let's current directory is foo, thus if I do:</p>
  
  <pre><code>~/foo$ ./myscript --var1=$VAR1
  </code></pre>
  
  <p>VAR1 would have some foo based value.</p>
  
  <p>Then, let's say I switched to bar directory. If I do:</p>
  
  <pre><code>~/bar$ ./myscript --var1=$VAR1
  </code></pre>
  
  <p>VAR1 should now have some bar based value.</p>
  
  <p>Is that possible? How?</p>