Created
October 19, 2012 11:59
-
-
Save miekg/3917889 to your computer and use it in GitHub Desktop.
getrfc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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