tReturn input if already a doi - scholarref - tools for DOI and BiBTeX reference extraction, fetching, and parsing | |
git clone git://src.adamsgaard.dk/scholarref | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit e655a934bf785bc43e71026e2ba1ae13ef0fc363 | |
parent d9efb84392ad1186ef7a7cac6daeab02b306d1d4 | |
Author: Anders Damsgaard | |
Date: Wed, 18 Sep 2019 13:00:26 +0200 Return input if already a doi Diffstat: M getdoi | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- | |
diff --git a/getdoi b/getdoi | |
t@@ -76,7 +76,11 @@ get_doi() { if [ -e "$1" ]; then doi=$(get_doi_from_file "$1") else - doi=$(get_doi_from_crossref "$@") + if [ $(expr "$1" : '^10\.[0-9]\+\/.*') -gt 0 ]; then + doi="$1" + else + doi=$(get_doi_from_crossref "$@") + fi fi echo "$doi" [ "$clip" = 1 ] && echo "https://doi.org/${doi}" | \ |