Last active
October 12, 2015 16:31
-
-
Save dmitryd/a364f09545c6eda0ed48 to your computer and use it in GitHub Desktop.
This little shell function allows to set environment variables when you cd into that directory.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Note: this is just a fragment that you should put in your ~/.bash_profile | |
# Tested on Mac only! | |
# | |
# If you want a more sophisticated and feature rich solution here are some pointers: | |
# - https://github.com/cxreg/smartcd | |
# - http://swapoff.org/ondir.html | |
function cd_ { | |
if [ -e .env_off ] ; then | |
. .env_off | |
fi | |
builtin cd "$*" | |
if [ -e .env ] ; then | |
. .env | |
fi | |
} | |
alias cd=cd_ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment