Makefile: add pickrand
[cmccabe-bin] / pdflatex.sh
1 #!/usr/bin/env bash
2
3 die() {
4     echo $@
5     exit 1
6 }
7
8 which pdflatex &> /dev/null || die "you must have pdflatex installed"
9
10 [ $# -eq 1 ] || die "you must give exactly one argument: the \
11 name of the tex file to use as input."
12
13 TMPDIR=`mktemp -d -t pdfgrep.XXXXXXXXXX` || exit 1
14 trap "rm -rf ${TMPDIR}; exit" INT TERM EXIT
15
16 INPUT_FNAME=$1
17 shift
18 pdflatex -output-directory "${TMPDIR}" < "${INPUT_FNAME}" || die "ERROR: pdflatex failed!"
19 mv -f ${TMPDIR}/*.pdf "${INPUT_FNAME}.pdf" || die "ERROR: couldn't find pdf output file"