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
  • https://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 04 '20 at 07:56
  • What do you mean by not work? Whar are the errors? – mmmmmm Jun 04 '20 at 09: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 04 '20 at 13:02
  • https://stackoverflow.com/questions/14679809/how-can-i-open-multiple-tabs-automatically-on-terminal-in-mac-os-lion-by-executi – firstpostcommenter Jun 06 '20 at 21:46
  • https://apple.stackexchange.com/questions/15317/how-can-i-write-a-script-to-open-multiple-terminal-tabs-and-execute-code-in-them – firstpostcommenter Jun 06 '20 at 21:51

0 Answers0