1

I can't seem to figure out how to get his bash script working.

#!/bin/bash 
export WORKON_HOME=~/.envs
source /usr/local/bin/virtualenvwrapper.sh
workon staging_env

It is using viretualenv and virualenvwrapper in order to use a Python virtual environment.

Typing these commands in the shell work perfectly fine, running it as a bash script does not work though.


Any ideas?

0

1 Answer 1

4

When you run a script, it creates its own instance of the shell (bash, in this case). Because of this, the changes are lost when the script ends and the script's shell is closed.

To make the changes stick, you'll have to source the script instead of running it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.