-
-
Save scemama/2fba1c38835fa4f36aca to your computer and use it in GitHub Desktop.
Gets a bibtex file from a DOI or an ISBN
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
str_utilisation="$0 (doi|isbn) <value>" | |
if [ "$#" -ne 2 ];then | |
echo ${str_utilisation} | |
exit 1 | |
fi | |
if [ "$1" == "doi" ];then | |
doi_raw=$2 | |
curl -G --data-urlencode "id=$doi_raw" "http://www.doi2bib.org/doi2bib" | |
elif [ "$1" == "isbn" ];then | |
isbn=$2 | |
curl "http://www.ottobib.com/isbn/${isbn}/bibtex" | perl -l -0777 -ne 'print $1 if /<textarea.*?>\s*(.*?)\s*<\/textarea/si' | |
else | |
echo ${str_utilisation} | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment