Close all Mac Terminal windows, but the one running a script

Posted by Greg Brown on Super User See other posts from Super User or by Greg Brown
Published on 2012-09-25T15:25:47Z Indexed on 2012/09/25 15:39 UTC
Read the original article Hit count: 448

Filed under:
|
|
|

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

© Super User or respective owner

Related posts about mac

Related posts about terminal