Using the Automator action from this recent hint, it is easy to post notifications from AppleScripts or the command line.
To set this up, simply do the following:
title, subtitle, and message. message a default value like "Notification sent." You can leave the default values other two blank. Now you can display a notification from the command line using the following command:
automator -D title='Title text' -D subtitle='Subtitle text' -D message='Message text' ~/Library/Workflows/'Display Notification.wflow'
To display notifications from AppleScripts, paste the following handler into your script, and call it using the form notify("Notification title", "Notification subtitle", "Notification message")
on notify(title, subtitle, message) if title as text is not "" then set title to " -D title=" & quoted form of (title as text) if subtitle as text is not "" then set subtitle to " -D subtitle=" & quoted form of (subtitle as text) if message as text is not "" then set message to " -D message=" & quoted form of (message as text) do shell script "automator" & title & subtitle & message & " ~/Library/Workflows/Display Notification.wflow" end notify
Mac OS X Hints
http://hints.macworld.com/article.php?story=20120831112030251