citadel

My dotfiles, scripts and nix configs
git clone git://jb55.com/citadel
Log | Files | Refs | README | LICENSE

rfc (368B)


      1 #!/usr/bin/env bash
      2 
      3 if [ -z $1 ]
      4 then
      5   printf "usage: rfc <rfc#>\n"
      6   exit 1
      7 fi
      8 
      9 RFC_DIR="$HOME/docs/rfcs"
     10 
     11 mkdir -p $RFC_DIR
     12 cd "$RFC_DIR"
     13 
     14 rfc_file="$RFC_DIR/rfc${1}.txt"
     15 
     16 if [ ! -f "$rfc_file" ]
     17 then
     18   url="https://www.rfc-editor.org/rfc/rfc${1}.txt" 
     19   curl --fail --compressed -s "$url" > "$rfc_file" || (rm -f "$rfc_file" && exit 1)
     20 fi
     21 
     22 exec lessr "$rfc_file"