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?

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 Dec 4 '12 at 2:24
  • This AppleScript, open a new Terminal window, how can I just focus the existing Terminal window?
    – user221797
    Nov 3 '16 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". Nov 6 '16 at 18:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.