I'm trying to enter commands in bashrc via script.
I run the command
source powerpyenv.sh
# powerpyenv.sh
echo '### Added by pyenv' >> teste
echo 'export PATH="$HOME/.pyenv/bin:$PATH"' >> teste
echo 'eval "$(pyenv init -)"' >> teste
echo 'eval "$(pyenv virtualenv-init -)"' >> teste
cat << EOF > temp.txt
### Activate virtualenv
alias manage="python $VIRTUAL_ENV/../manage.py"
alias r="manage runserver"
alias sa='source .venv/bin/activate; PS1="('basename \"$VIRTUAL_ENV\"')\e[1;34m:/\W\e[00m$ "; clear'
### Short prompt
alias pa='PS1="('basename \"$VIRTUAL_ENV\"')\e[1;34m:/\W\e[00m$ "; clear'
alias p='PS1="\e[1;34m/\W\e[00m$ "; clear'
alias rm="rm -i"
EOF
cat temp.txt >> teste
rm -f temp.txt
source teste
echo "Done"
I threw everything into a test for now.
See the test result:
### Added by pyenv
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
### Activate virtualenv
alias manage="python /../manage.py"
alias r="manage runserver"
alias sa='source .venv/bin/activate; PS1="("")\e[1;34m:/\W\e[00m$ "; clear'
### Short prompt
alias pa='PS1="("")\e[1;34m:/\W\e[00m$ "; clear'
alias p='PS1="\e[1;34m/\W\e[00m$ "; clear'
alias rm="rm -i"
What are the problems here?
How do I fix this?