tFix return status during use of compact conditionals - scholarref - tools for DOI and BiBTeX reference extraction, fetching, and parsing
(HTM) git clone git://src.adamsgaard.dk/scholarref
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 4d98fd2155f080ea08ee13a25de2fcd21a16f7d6
(DIR) parent 9d653a034f6d3ca1fde34d264f10f3af23922aff
(HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Fri, 15 Nov 2019 14:51:20 +0100
Fix return status during use of compact conditionals
Diffstat:
M getref | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
---
(DIR) diff --git a/getref b/getref
t@@ -100,22 +100,21 @@ strip_doi() {
get_citation() {
doi=$(echo "$1" | strip_doi)
url="$host/$1"
- [ "$verbose" = 1 ] && echo "connecting to $url"
+ [ "$verbose" = 1 ] && echo "connecting to $url" || :
result=$($prefix curl --location \
--header "Accept: application/x-bibtex" \
--silent --show-error "$url")
echo "$result" | grep -q '<html>' && die 'no result found'
result="$(echo "$result" | format_bibtex_key)"
- [ "$fulljournal" = 0 ] && result="$(echo "$result" | abbreviate_journal_name)"
- [ "$fullauthor" = 0 ] && result="$(echo "$result" | abbreviate_author_name)"
+ [ "$fulljournal" = 0 ] && result="$(echo "$result" | abbreviate_journal_name)" || :
+ [ "$fullauthor" = 0 ] && result="$(echo "$result" | abbreviate_author_name)" || :
result="$(echo "$result" | grep -v -e 'url = ' -e 'month = ' )"
if [ "$nonewline" = 1 ]; then
printf "\n%s" "$result"
else
echo "$result"
fi
- [ "$notify" = 1 ] && notify-send "${0##*/}" "added: $(echo "$result" | cut -c-80)"
- printf ''
+ [ "$notify" = 1 ] && notify-send "${0##*/}" "added: $(echo "$result" | cut -c-80)" || :
}
verbose=0