A trick to run shell examples with a leading $
- Published at
- Updated at
- Reading time
Remy Sharp shared a beautiful shell trick that he found in Mikkel Malmberg's dotfiles. You probably know the inconvenience (it's not a big problem in my opinion); you read some documentation and find a shell command you have to run. Unfortunately, it includes a leading
$ symbol. Now, you have to carefully copy the line to exclude the
$ because your shell won't understand the
What if your shell would be able to deal with a leading
$ in your pasted commands? Here's the solution.
$ file to your
$PATH that includes the following and you're done! 🎉
$ command does is running the rest of the passed command arguments. That's beautiful!
Thanks Remy and Mikkel!
- How to list all open GitHub pull requests and select one on the command line
- A terminal script to get notified when macOS changes its appearance (dark/light mode)
- How to build useful, empathic and robust CLI tools
- A git alias to show a detailed git branch overview
- How to force yourself to leave the computer using the leave command