Services are how osx handles this sort of thing.
Under the Application Menu (in this case 'Finder') there is (almost) always a Services menu option which will provide Services that apply to the current Application and its current state. Typically the state is what type of object is selected (text, files/folders, etc).
They can be enabled, disabled, and assigned keyboard shortcuts in the System Preferences panel that only makes sense for the last of those three, Keyboard.

To make a Service that applies a shell script to files/folders in Finder:
Launch automator and make a new Service type document.

- set the type of object the Service applies to (
files or folders)
- set the Application in which the Service is available (finder)
- Alternatively there is a
Get Selected Finder Items action.
- add an action of
Run Shell Script
- decide if you want the input as arguments or stdin
It should look something like this:

automator will automatically place it in your ~/Library/Services folder when you save which will make it available (almost) immediately via the Application -> Services menu, or the contextual (right click) menu.

