Your Ad Here

Posted By

nerdfiles on 12/10/11


Tagged

workon virtualenv


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

wliment


work


 / Published in: Bash
 

"work" in the current dir.

  1. function work() {
  2. cur="$PWD"
  3. s=$cur
  4. set -- "$s"
  5. IFS="/"; declare -a Array=($*)
  6. len=${#Array[@]}
  7. len=($len-1)
  8. proj=${Array[$len]}
  9. proj=${proj/"-"/"_"}
  10.  
  11. if [[ ! -d "$HOME/.virtualenvs/$proj" && ! -L "$HOME/.virtualenvs/$proj" ]]; then
  12. mkvirtualenv $proj
  13. fi
  14.  
  15. if [[ -d "$HOME/.virtualenvs/$proj" ]]; then
  16. workon $proj
  17.  
  18. echo "Now working with: "
  19. echo "~/.virtualenvs/$proj/bin/python"
  20. echo "~/.virtualenvs/$proj/lib/python2.7/site-packages/"
  21. if [ $debug ]
  22. then
  23. echo 'nana'
  24. else
  25. which python
  26. fi
  27. fi
  28. }

Report this snippet  

You need to login to post a comment.