I am writing a quick start shell script to automatically set up my development environment for a current project. However, none of the commands in the shell script can be executed after my server starts because it takes over the terminal. I am trying to open a new tab, start the server in there and then continue executing my shell script in the original tab. My script currently looks like this:
subl myProj
cd myProj
gnome-terminal --tab
npm start
google-chrome http://localhost:3000
myProj ends up opening in the new tab and the server starts in the original tab. chrome never launches.
Scripts execute commands in sequence, and wait until each command finishes. However, there is a way to allow the script to continue executing past a specific command - add &
on the end of the script.
For instance:
!#/bin/bash
firefox
echo "Next line"
Will wait till firefox is closed.
!#/bin/bash
firefox &
echo "Next line"
Will execute echo
command and allow keeping firefox open
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments