Makefile: add pickrand
[cmccabe-bin] / remove-pdf-password.sh
1 #!/usr/bin/env bash
2
3 die() {
4     echo $@
5     exit 1
6 }
7
8 [[ $# -eq 1 ]] || die "this script takes exactly one argument: the name of a pdf"
9 INPUT=$1
10 INPUT_BASE=${INPUT%.pdf}
11 [[ -f "${INPUT}" ]] || die "input file ${INPUT} does not exist."
12 echo -n Password: 
13 read -s PASSWORD
14 echo
15 exec qpdf -password="${PASSWORD}" -decrypt "${INPUT}" "${INPUT_BASE}.decrypted.pdf"