citadel

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

pdfget (255B)


      1 #!/usr/bin/env bash
      2 
      3 set -eou pipefail
      4 
      5 fname="$HOME/dl/$(sha256sum <<<"$1" | cut -d" " -f1).pdf"
      6 
      7 if [ -f "$fname" ]; then
      8 	open "$fname"
      9 	exit 0
     10 fi
     11 
     12 curl -sL --user-agent definitely-not-curl "$@" > "$fname"
     13 
     14 printf "saved %s\n" "$fname" >&2
     15 open $fname