In emacs, you can type Escape, x, shell-command, enter, then enter a command that runs your script. Option-x works for Escape-x if you have enabled the appropriate "Use option key as meta key" option in Terminal, or if you are using the OS X GUI port of emacs.