virtualenv_activate local virtualenv_dir HOME work virtualenv if -ne t

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
virtualenv_activate ()
{
local virtualenv_dir="$HOME/work/virtualenv"
if [ $# -ne 1 ]; then
echo "
Usage:
virtualenv_activate <env_dir>
"
return 1
fi
local activate_script="$virtualenv_dir/$1/bin/activate"
if [ ! -f "$activate_script" ]; then
echo "Invalid environment: $1"
return 1
fi
. $activate_script
return 0
}