Run Dollar Command

A trick to run shell commands copied with `$` prefix.


Do you see a lot of shell commands in READMEs on GitHub like this?

$ echo hello

How annoying is that leading dollar sign?! 😡

When copy/pasting, I often accidentally grab the extraneous $, especially using the trick of triple-clicking to select the whole line.

What if your terminal could just ignore the $ and let you paste the whole $ echo hello command?

Well, good news! Define this function in your shell config:

function $ { $@ }

It will just run anything after the $! ✨

Voila! 🎉