Close all Mac Terminal windows, but the one running a script
- by Greg Brown
I am trying to create a shell script that runs a python simulation programing in 4 terminal windows. I have the script that launches the program four times in four separate terminal windows(total of 5 windows, 4 for the python programs, and one to control the other terminal windows). I want to now create a script that I can run in the control terminal window that closes and kills the programs of the other four terminal windows, but still have the control one open.
What I have so far is something like this
#!/bin/sh
osascript -e 'tell app "Terminal"
do script "killall python"
end tell'
osascript -e 'tell app "Terminal" to quit'
osascript -e 'tell app "Terminal" to open'
The problem is that the last line doesn't work because it closes all the windows including the one the script is executing in. I am not really familiar with shell or apple script so any help would be welcomed. I posted on Stack, but I think this might be a better place for an automation type question. Thanks