Applescript to monitor terminal changes
tell application "Terminal"
    repeat 120 times -- ~ 2 minutes
        if contents of front window contains "word" then
            say "match"
            -- insert your code here
            exit repeat
        else
            delay 1
        end if
    end repeat
end tell