Skip to content

Instantly share code, notes, and snippets.

@sionide21
Created November 7, 2013 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sionide21/7356242 to your computer and use it in GitHub Desktop.
Save sionide21/7356242 to your computer and use it in GitHub Desktop.
ve() {
local curdir ve
curdir="$PWD"
[ -z "$1" ] && ve="ve" || ve="$1"
while ! ls -d "$ve" >/dev/null 2>&1; do
if [ "$PWD" == "/" ]; then
echo "Cannot find a '$ve' directory on the current path" >&2
cd $curdir
return -1
fi
cd ..
done
echo "Using $PWD"
source "$ve/bin/activate"
cd "$curdir"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment