I'm a complete noob with bash scripting so maybe a stupid question: I have 3 scripts to auto run a react web app along with firebase cloud functions, the project structure is something like this:
-general:
|_start.sh
|_start-frontend.sh
|_start-backend.sh
-backend
|_functions
-frontend
|_my_app
please note that general is an npm project with a package.json file:
{
"name":"my_app",
"version":"0.1.0",
"workspaces":[
"backend/functions",
"frontend/my_app"
],
"author":"Giulio Serra",
"license":"ISC",
"scripts": {
"start": "sh ./start.sh"
}
}
so when I run npm start
start.sh is executed:
#!/bin/bash
open -a Terminal "`sh start-backend.sh`"
open -a Terminal "`sh start-frontend.sh`"
here are the content of start-frontend:
#!/bin/bash
cd ../frontend/my_app
npm start
and start-backend:
#!/bin/bash
cd ../backend/functions
kill $( lsof -i:8085,9000 -t )
firebase emulators:start --import /Users/giulioserra/Documents/Applicazioni/my_app/backend/dev_res
I just want to open 2 terminals: one with react and another with the emulators suite with the functions, but all I managed to do is to open one terminal with just the emulator suite (basically start-frontend.sh gets ignored) without any logs.
if I switch the instructions on the file: start-backend it's ignored and start-fronted.sh is executed again without any logs (so I don't have any clues about the port used and compiled warnings).
Any hints on how to fix the scripts such as both start-frontend.sh and start-backend.sh are executed on two different terminal instances with the proper logs?I'm on Mac Monterey btw Thanks.