I am launching a new terminal on Ubuntu and want to activate a Python virtual environment once it opens. The virtual environment is normally activated by running:
source ./environment/bin/activate
where my virtual environment is called environment
.
The command I'm using to do this is:
gnome-terminal --geometry 160x80+-26+4 --working-directory=/home/user/Work/project -x bash -c "source /home/user/Work/project/environment/bin/activate; exec bash"
The path to the activate script is correct, but when I launch the terminal the virtual environment is not activated.
I suspect that's because source runs in one bash instance, but then exec bash
creates a new one in order to keep the terminal open (just a hypothesis here).
How can I get the source
command to affect that new terminal and leave it open?