4

I'm looking for a way for the terminal to get my attention after a command finishes. Something like this:

$ ./lengthy_command.sh ; focus_terminal

Is there any easy way to do that on Snow Leopard?

1 Answer 1

11
$ ./lengthy_command.sh; osascript -e 'tell application "Terminal" to activate'

If you want to get even fancier:

$ ./lengthy_command.sh; osascript -e 'tell application "Terminal"' -e 'activate' -e 'display alert "Done!"' -e 'end tell'
3
  • My god. That craziness actually works. :p Commented Dec 4, 2012 at 2:24
  • This AppleScript, open a new Terminal window, how can I just focus the existing Terminal window?
    – user221797
    Commented Nov 3, 2016 at 11:46
  • @user221797 These commands shouldn't open a new Terminal window unless there's no existing window to focus. Are you using some other terminal program instead of /Applications/Utilities/Terminal.app? If so, you need to activate that one, instead of "Terminal". Commented Nov 6, 2016 at 18:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .