/ Published in: Bash
"work" in the current dir.
Expand |
Embed | Plain Text
function work() { cur="$PWD" s=$cur set -- "$s" IFS="/"; declare -a Array=($*) len=${#Array[@]} len=($len-1) proj=${Array[$len]} proj=${proj/"-"/"_"} if [[ ! -d "$HOME/.virtualenvs/$proj" && ! -L "$HOME/.virtualenvs/$proj" ]]; then mkvirtualenv $proj fi if [[ -d "$HOME/.virtualenvs/$proj" ]]; then workon $proj echo "Now working with: " echo "~/.virtualenvs/$proj/bin/python" echo "~/.virtualenvs/$proj/lib/python2.7/site-packages/" if [ $debug ] then echo 'nana' else which python fi fi }
You need to login to post a comment.
