I'm working on something that requires me to run a few terminals, each with their own python virtual environment. This takes some time to open manually, so I would like to automate this setup by having a .sh
file to handle it, and then leave them open ready for me to work with. I'm using Linux Mint 20.2.
For some reason I can't figure out how to write this script. I have tried various things including this:
#!/bin/bash
gnome-terminal -- /bin/sh -c 'cd ~/projects/proj/d1; exec bash'
source $(pwd)/venv/bin/activate
exec bash
gnome-terminal -- /bin/sh -c 'cd ~/projects/proj/d2; exec bash'
source $(pwd)/venv/bin/activate
exec bash
gnome-terminal -- /bin/sh -c 'cd ~/projects/proj/d3; exec bash'
source $(pwd)/venv/bin/activate
exec bash
(I am quite new to linux)
Edit: I've also tried gnome-terminal -- /bin/sh -c 'cd ~/projects/qcaas/qcaas_cloud; source $(pwd)/venv/bin/activate; exec bash'
, which just gives /bin/sh: 1: source: not found
.
gnome-terminal
is not passed tognome-terminal
, they are running in the shell you are using to execute the scriptsource
isbash
, thesh
equivalent would be.
.
was one of the other things I had tried. Confirmed that replacingsource
with.
also doesn't work, it appears to not do anything, just leaves the terminal open (no errors).