Local RFCs

Previous | Next

RFCs are important documents that explain how the internet works among other things. Fortunately RFC are freely available and can be downloaded with a script like this one:

#!/usr/bin/env bash

url=https://tools.ietf.org/rfc/rfc
for n in {0..9000}; do
    (
        if wget -q "$url$n.txt" &> /dev/null; then
            echo "Downloading $url$n.txt"
        fi
    ) &

    # download rfc's in batches of 10
    while test $(jobs -p | wc -w) -ge 10; do wait -n; done
done

I also define a function that opens RFCs like man-pages:

rfc() (
    file=$RFCDIR/rfc$1
    [ -f $file ] && less $file || echo "Could not find RFC$1"
)

now rfc 20 will open RFC 20.