spring work

This commit is contained in:
ackman678
2021-05-03 21:03:40 -07:00
parent 980e493cf7
commit 29956101f2
2 changed files with 21 additions and 20 deletions

38
sdoi.sh
View File

@@ -26,25 +26,7 @@ doi=$1
fn=$2
set -e #exit if an error
uid=$(curl -s "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=$doi&field=doi&retmode=xml" | grep -E "<Id>[0-9]+</Id>" | sed -E "s|<Id>([0-9]+)</Id>|\1|")
tmpBib=$(mktemp -p --suffix=.bib)
if [ -z "$uid" ]; then
fetchBib_doiDotOrg
else
fetchBib_pubmed
fi
if [ -s "$tmpBib" ]; then
import_bib
else
echo "sorry, doi not found.."
clean_up
fi
# set -v -x -e #debugging
function import_bib {
#decide whether to process and move an associated pdf or just exit
@@ -111,3 +93,21 @@ function clean_up {
exit 1
}
uid=$(curl -s "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=$doi&field=doi&retmode=xml" | grep -E "<Id>[0-9]+</Id>" | sed -E "s|<Id>([0-9]+)</Id>|\1|")
tmpBib=$(mktemp -p ./ --suffix=.bib)
if [ -z "$uid" ]; then
fetchBib_doiDotOrg
else
fetchBib_pubmed
fi
if [ -s "$tmpBib" ]; then
import_bib
else
echo "sorry, doi not found.."
clean_up
fi