Skip to content

Instantly share code, notes, and snippets.

@deeplycloudy
Created March 24, 2020 16:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deeplycloudy/e72bc1379e7b2e5451bec0acf2aaa376 to your computer and use it in GitHub Desktop.
Save deeplycloudy/e72bc1379e7b2e5451bec0acf2aaa376 to your computer and use it in GitHub Desktop.
Use dx.doi.org service to get a BibTeX-formatted reference from a DOI.
#!/bin/bash
# | pbcopy; pbpaste are mac-only commands; delete to simply print to the shell.
# Use: getbib $DOI where $DOI is something like 10.xxx/xxxxxx
getbib(){
curl -LH "Accept:text/bibliography; style=bibtex" http://dx.doi.org/$1 2>/dev/null | cut -c 2- | pbcopy ; pbpaste
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment