-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathinit.bash
More file actions
39 lines (32 loc) · 789 Bytes
/
init.bash
File metadata and controls
39 lines (32 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash
: <<'!COMMENT'
GGCOM - Docker - pyenv v201508140234
Louis T. Getterman IV (@LTGIV)
www.GotGetLLC.com | www.opensour.cc/ggcom/docker/pyenv
Thanks:
bash - How to keep quotes in args? - Stack Overflow - Thank you Dennis Williamson!
http://stackoverflow.com/a/1669493
!COMMENT
# Attempt to keep quotes in arguments passed to Docker, which is then passed to here.
pyrun=''
whitespace="[[:space:]]"
for i in "$@"
do
if [[ $i =~ $whitespace ]]
then
i=\"$i\"
fi
pyrun="${pyrun}${i} "
done
pyrun="python ${pyrun}"
unset i
# Run as user
sudo -u python_user 'bash' <<EOF
export HOME=/home/python_user
export PYENV_ROOT=$HOME/.pyenv
export PATH=$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
pyenv rehash
$pyrun
EOF
#eval "$(pyenv init -)"
#eval "$(pyenv virtualenv-init -)"