I've written a service component called ShellService which allows folks to execute UNIX shell commands from a text window in an application like TextEdit or ProjectBuilder.
The component adds an "Execute Text" menu item. When you select some text and choose it, the text is sent to your MacOS X shell to be executed. The shell's output is then put into the text window.
Feedback welcome via the email links on the ShellService page.
-Christopher Corbell
Mac OS X Hints
http://hints.macworld.com/article.php?story=20020210120111278