How to execute Terminal command using selected text? I want to bind a shortcut to run a command in Terminal with text that I selected while web browsing. How could I do this?
You can achieve this by making an automator workflow and saving it as a service.

Open Automator.app, choose to make a Service.

In the top menu set "Service receives selected" to "text" in "any application".

From the Actions, Library menu search for "Get Value of Variable" and drag to the right in the workflow area.  Again in the Actions, Library search for "Run AppleScript" and drag to the workflow area.  

In the "Run AppleScript" action enter the flowing code:

on run {input, parameters}

    set terminalCommand to item 1 of input

    tell application "Terminal"
        activate
        do script terminalCommand
    end tell

    return input
end run


Add a variable by clicking on the little double bar icon at the bottom of the window and then right-clicking in the variables frame to create a new variable.  Name your variable anything you like.  When your done your workflow should look like below.  Save it and name it something like "Run in Terminal".  Now when your in a web browser you can right click and navigate to Services and you will see your "Run in Terminal" command, which will open up terminal and run the highlighted text.