0

I'm writing a bash script, and am attempting to open a separate terminal window to run commands in. I was able to open a new terminal window with open -a Terminal ., but is it possible to switch between windows from bash?

Stephen
  • 11
  • 1
  • 3
  • 1
    Yes, you can do that using AppleScript. Some related questions: http://stackoverflow.com/questions/1794050/applescript-to-open-named-terminal-window and http://stackoverflow.com/questions/5047748/select-a-particular-tab-in-terminal-depending-upon-the-content-using-applescript – nwinkler Jul 14 '15 at 15:41
  • Great, thanks for your help! – Stephen Jul 14 '15 at 17:33

1 Answers1

1

You can run AppleScript scripts using command osascript.

Script for activating Terminal window:

tell application "Terminal" to activate

Or opening new Terminal window:

tell application "Terminal"  
  do script " "  
  activate  
end tell

Found here - https://superuser.com/questions/195633/applescript-to-open-a-new-terminal-window-in-current-space

Community
  • 1
  • 1
Ondřej Šotek
  • 1,793
  • 1
  • 15
  • 24