Skip to content

Instantly share code, notes, and snippets.

@PatrickCronin
Last active November 15, 2019 02:28
Show Gist options
  • Save PatrickCronin/ee82ea8c7fe1965cfdac2fe1eea97827 to your computer and use it in GitHub Desktop.
Save PatrickCronin/ee82ea8c7fe1965cfdac2fe1eea97827 to your computer and use it in GitHub Desktop.

Bash tips

  • Capture the result of a command as a string: $( <cmd> )
> emacs -nw $(git ls-files | grep the-file)
  • Re-run last command: !!
> git ls-files | grep the-file
some/long/path/you/have/not/memorized
> emacs -nw $(!!)
  • Capture the result of a command and feed it into a program: <( <cmd> )
> diff file.go <(gofmt -s file.go)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment