plumber

Plumber – a modern approach to plumbing
git clone git://r-36.net/plumber
Log | Files | Refs | README | LICENSE

doiopener (274B)


      1 #!/bin/sh
      2 
      3 set -x
      4 
      5 if [ $# -lt 1 ];
      6 then
      7 	printf "usage: [-o] %s URI\n" "$(basename "$0")" >&2
      8 	exit 1
      9 fi
     10 
     11 uri="$1"
     12 doi="$(printf "%s\n" "${uri}" | cut -d':' -f 2-)"
     13 pdfuri="$(oadoi "${doi}")"
     14 if [ $? -gt 0 ];
     15 then
     16 	plumb "http://doi.org/${doi}"
     17 else
     18 	plumb "${pdfuri}"
     19 fi
     20