Signed-off-by: Colin McCabe <cmccabe@alumni.cmu.edu>
--- /dev/null
+#!/bin/bash
+
+die() {
+ echo $@
+ exit 1
+}
+
+which pdflatex &> /dev/null || die "you must have pdflatex installed"
+
+[ $# -eq 1 ] || die "you must give exactly one argument: the \
+name of the tex file to use as input."
+
+TMPDIR=`mktemp -d -t pdfgrep.XXXXXXXXXX` || exit 1
+trap "rm -rf ${TMPDIR}; exit" INT TERM EXIT
+
+INPUT_FNAME=$1
+shift
+pdflatex -output-directory "${TMPDIR}" < "${INPUT_FNAME}" || die "ERROR: pdflatex failed!"
+mv -f ${TMPDIR}/*.pdf "${INPUT_FNAME}.pdf" || die "ERROR: couldn't find pdf output file"