Launch shell scripts via keyboard shortcut in Mac OS X

Solution 1:

In 10.6 Snow Leopard it's quite easy to add any command to the Services menu of each application (or specific applications), and then assign a keyboard shortcut.

Here on Super User, see Fast User Switching/Apple Menu? for an example that invokes some shell script.

Solution 2:

You can use Keyboard Maestro to launch an application or script from the keyboard. There is also IronAHK (AutoHotkey rewrite) which works under Mono, example:

^n::Run, /path/to/script.py

although make sure the script has sufficient execute permissions and a shebang line.

Solution 3:

You can also use automator to make a contextual menu invoked script.