Scripts to create and activate virtualenvs according to env_$current_folder syntax
result=${PWD##*/}
folder=env_$result
path=env_$result/bin/activate
if [ ! -d "$folder" ];
then echo "Virtualenv not present in the current folder '$PWD'."
else . $path
fi
# Should be sourced(.) in ./bashrc
alias activate='. ~/.activate'
alias venv='. ~/.venv
if [ $# -eq 0 ]
then
echo "No arguments supplied. Usage venv 2.7|3.5|3.6"
exit
else
case "$1" in
2.7) echo "Python 2.7 selected.";;
3.5) echo "Python 3.5 selected.";;
3.6) echo "Python 3.6 selected.";;
*) echo "Invalid option. Usage venv 2.7|3.5|3.6"
exit;;
esac
fi
interpreter="python$1"
result=${PWD##*/}
folder=env_$result
path=env_$result/bin/activate
if [ -d "$folder" ];
then
echo "Virtualenv $folder already present."
else
virtualenv -p $interpreter $folder
fi
# Activates the
. $path