plumber

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

wikipediaopener (380B)


      1 #!/bin/sh
      2 
      3 if [ $# -lt 1 ];
      4 then
      5 	printf "usage: [-o] %s URI\n" "$(basename "$0")" >&2
      6 	exit 1
      7 fi
      8 
      9 URI="$1"
     10 WIKIURI="$(printf "%s" "${URI}" | cut -d':' -f 1)"
     11 LANG="$(printf "%s" "${WIKIURI}" | cut -d'-' -f 2)"
     12 [ -z "$LANG" ] && LANG="en"
     13 ARTICLE="$(printf "%s" "${URI}" | cut -d':' -f 2-)"
     14 PURI="$(printf "https://%s.wikipedia.org/wiki/%s" "$LANG" "$ARTICLE")"
     15 
     16 plumb "${PURI}"
     17