Created
May 19, 2017 04:03
-
-
Save ryanhs/faf1dd5163fb972339e500870d40f6f6 to your computer and use it in GitHub Desktop.
execute something when entering directory added on .bashrc
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
| # virtualenv auto activation | |
| function cd { | |
| builtin cd "$@" | |
| DEACTIVATE_TYPE="function"; | |
| DEACTIVATE_EXIST=$(type -t deactivate); | |
| if [ -d ".venv" ] | |
| then | |
| source .venv/bin/activate #auto activate | |
| else | |
| if [ "$DEACTIVATE_EXIST" == "$DEACTIVATE_TYPE" ]; then deactivate; fi #auto deactivate | |
| fi | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment