#!/bin/bash -x

# These three options make it harder to for some part of a script to
# fail without you recognizing it. nounset means that references to an
# unset variable result in an error. This means that you can no longer
# do stuff like this if VAR is potentially unset, because "$VAR" returns
# an error rather than "":
#
# if [ "$VAR" ]; then
#
# fi
#
# To explicitly indicate that you are OK with the variable potentially
# being empty you can instead use ${VAR:-}.

set -o nounset
set -o pipefail
set -o errexit 

echo "" > all-papers.txt
for pdf in *.pdf; do
  pdftotext -nopgbrk $pdf - >> all-papers.txt
done

echo "<html><body>" > pdfs.html
for pdf in *.pdf; do
  echo \<a href=\'$pdf\'\>$pdf\</a\> >> pdfs.html
done
echo "</body></html>" >> pdfs.html
