0

From a .command file, I want to write steps so that multiple terminal tabs are opened and in each of those tabs a long running command is run and then my .command file should complete without stopping those long running commands.

Is such a requirement possible in terminal?

The below script does not work but I wanted to do something like the below steps:

osascript -e 'tell application "Terminal" to activate' -e 'tell application "System Events" to tell process "Terminal" to keystroke "t" using command down'
APP_BASE_LOCATION="/somepath"
cd $APP_BASE_LOCATION/app1
mvn spring-boot:run

osascript -e 'tell application "Terminal" to activate' -e 'tell application "System Events" to tell process "Terminal" to keystroke "t" using command down'
APP_BASE_LOCATION="/somepath"
cd $APP_BASE_LOCATION/app2
npm start
5
  • askubuntu.com/a/611687 this answer suggests chaining multiple commands with && (careful: if any command in the chains returns error, next ones will not be executed) or using ; between two commands. so I think you can wrap the these two blocks in individual functions which you can call in one line. – anki Jun 4 '20 at 7:56
  • What do you mean by not work? Whar are the errors? – mmmmmm Jun 4 '20 at 9:11
  • @user151019: For example, the first line opens a new terminal tab. After opening the new tab I want the commands in line 2, 3, 4 to be executed in the new terminal tab and then come back to the original tab and run line 6(which opens another new tab and runs another long running command). Right now a new tab is opened and after that the commands are run in the same initial terminal tab – firstpostcommenter Jun 4 '20 at 13:02

You must log in to answer this question.

Browse other questions tagged .