Skip to content

Instantly share code, notes, and snippets.

@miekg
Created October 19, 2012 11:59
Show Gist options
  • Save miekg/3917889 to your computer and use it in GitHub Desktop.
Save miekg/3917889 to your computer and use it in GitHub Desktop.
getrfc
#!/bin/zsh
# Retrieve RFC and/or drafts. By Miek Gieben (c) 2012, licensed under the GPL v2.
# RFC urls
# http://tools.ietf.org/pdf/rfc5737
# http://tools.ietf.org/rfc/rfc5737.txt
# Draft urls
# http://tools.ietf.org/id/draft-gieben-auth-denial-of-existence-dns-00.txt
# http://tools.ietf.org/pdf/draft-gieben-auth-denial-of-existence-dns-00.txt
tools="http://tools.ietf.org"
getopts "p" pdf
if [[ $pdf == "p" ]]; then shift; fi
for rfc in "$@"; do
if [[ $rfc =~ ^[0-9]+$ ]]; then
echo RFC >&2
case $pdf in
"")
wget -q $tools/rfc/rfc$rfc.txt -O $rfc.txt && echo $rfc.txt >&2
;;
"p")
wget -q $tools/pdf/rfc$rfc -O $rfc.pdf && echo $rfc.pdf >&2
;;
esac
continue
fi
echo I-D >&2
case $pdf in
"")
wget -q $tools/id/$rfc -O $rfc.txt && echo $rfc.txt >&2
;;
"p")
wget -q $tools/pdf/$rfc -O $rfc.pdf && echo $rfc.pdf >&2
;;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment