scripts/dot-local/share/sav-quotes/get-xkcdb-quotes

12 lines
292 B
Text
Raw Permalink Normal View History

#!/usr/bin/env bash
sum() {
declare -i acc
for i; do acc+=i; done
echo $acc
}
curl -s 'http://www.xkcdb.com/?random1' |
hxnormalize -i 0 -l 99999999999 -x | hxselect -cs '<br>\n%<br>\n' 'span.quote' |
html2text -b 0 | hxunent | sed '$d; s/ *$//' | sed '$d'
exit $(sum ${PIPESTATUS[*]})