Last active
December 16, 2015 05:29
-
-
Save dryan/5384505 to your computer and use it in GitHub Desktop.
activate a virtualenv if present on cd. additionally, if a "set_env.sh" file is present with environment variables, load those in.
This file contains hidden or 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
| # add this to the end of your .bashrc, .zshrc or equivalent | |
| function cd() { | |
| builtin cd "$@" | |
| if [ -f "bin/activate" ] | |
| then | |
| source "bin/activate" | |
| elif [ -f "../bin/activate" ] | |
| then | |
| source "../bin/activate" | |
| else | |
| fi | |
| if [ -f "set_env.sh" ] | |
| then | |
| source "set_env.sh" | |
| fi | |
| } |
This file contains hidden or 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
| export ENVIRONMENT_VARIABLE_NAME = "value" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment