Dotfiles for different machines on different branches.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
426 B

  1. #!/bin/sh
  2. [ -z "$1" ] && echo "Give either a pdf file or a DOI as an argument." && exit
  3. if [ -f "$1" ]; then
  4. # Try to get DOI from pdfinfo or pdftotext output.
  5. doi=$(pdfinfo "$1" | grep -io "doi:.*") ||
  6. doi=$(pdftotext "$1" 2>/dev/null - | grep -io "doi:.*" -m 1) ||
  7. exit 1
  8. else
  9. doi="$1"
  10. fi
  11. # Check crossref.org for the bib citation.
  12. curl -s "http://api.crossref.org/works/$doi/transform/application/x-bibtex" -w "\\n"