#!/usr/bin/env bash # Compile a single lecture file in isolation (for use by parallel cleanup # agents -- they each get their own jobname so the builds don't clobber). # # Usage: scripts/check_lecture.sh # e.g. scripts/check_lecture.sh 7 # compiles lectures/lecture07.tex set -euo pipefail if [[ $# -lt 1 ]]; then echo "usage: $0 " >&2 exit 2 fi N=$(printf "%02d" "$1") DIR="$(cd "$(dirname "$0")/.."; pwd)" mkdir -p "$DIR/build" WRAPPER="$DIR/build/check_${N}.tex" cat > "$WRAPPER" </dev/null 2>&1 || { echo "--- COMPILE FAILED for lecture ${N}; tail of log: ---" >&2 tail -25 "check_${N}.log" >&2 || true exit 1 } echo "OK: build/check_${N}.pdf"