I'm using Windows Terminal running Ubuntu. My goal is to open 5 different tabs, navigate to specific directories within each of those tabs, and start certain services therein.
As a bonus, I'd like to colour the tabs and title them for tidiness' sake, but this is not vital.
#!/usr/bin/env sh
# simple demo script for launching all desired services at once
cd /main/directory
sudo service redis-server start
sudo service postgresql start
# Note this does not yet work as desired. The tabs are generated, but the command after the color value execute in the current tab, and not the newly created tab.
cmd.exe /c "wt.exe" --window 0 new-tab --title "APIService" --tabColor "#E74C3C" && cd apiserv/ && npm start
cmd.exe /c "wt.exe" --window 0 new-tab --title "AuthServ" --tabColor "#F39C12" && cd authserv/ && npm start
cmd.exe /c "wt.exe" --window 0 new-tab --title "MainServ" --tabColor "#F4D03F" && cd mainserv/ && rails s
cmd.exe /c "wt.exe" --window 0 new-tab --title "Sidekiq" --tabColor "#3498DB" && cd mainserv/ && sidekiq
cmd.exe /c "wt.exe" --window 0 new-tab --title "ClientServ" --tabColor "#27AE60" && cd clientserv/ && yarn start
I like to think I have most of (or at least some of) the pieces I need to achieve my desired result - there's no issue with getting the services running individually - but obviously I'm lacking some bash knowledge to get them working properly together. It'll open one tab, colour and (temporarily) name it, but the rest of the command (eg. '&& cd apiserv/ && npm start') executes in the original tab, and none of the other commands are reached.
At present, if I omit the commands after the colour value (at each occurrence, starting from the &&), the 5 tabs will be created and coloured. Their titles will appear, but quickly be overwritten by the default name. This isn't ideal, but it's not a main priority.