Here’s a cool trick to use in a script, especially one running the the background which needs to alert on some type of event:

osascript -e 'display notification "That task just finished" with title "Update from background script!"'

More on the Open Scripting Architecture