I am running Ubuntu 21.04 and I want to create a script, that would do the following:
Run:
cd && cd path/to/repo && git pull && npm i && code . && npm run dev
Then open a new GNOME Terminal tab using:
gnome-terminal --tab
Then switch to this tab and run:
cd && cd path/to/repo && git reset --hard && git pull -f && npm i && npm run dev
So basically I want one terminal with 2 tabs running 2 development servers.
I tried with xdotool
and xte
, but it never worked (keys aren't even pressed).
Is it even possible to do what I want?
As suggested below I tried, it gave me failed to run cd
so I googled and came up with the following:
gnome-terminal --tab -- /bin/bash -e -c "cd path/to/repo && ls && git pull && npm i && code . && npm run dev" --tab -- /bin/bash -e -c "cd path/to/repo && git reset --hard && git pull -f && npm i && npm run dev"
But the problem is that npm run dev
is not supposed to ever stop, and so the second terminal tab is not ever opened.
And I need to run them together...