18
0

Consolidate document creation scripts and fix bugs

Replace the individual new_knitr_document, new_tex_assignment, and
new_tex_letter scripts with a single new_tex_document script that takes
a document type as its first argument. Fix bugs present in all scripts:
unquoted variables, TMPDIR name collision, missing existence checks, and
mktemp running unconditionally. Add cdsc_tex_aliases.sh for backwards
compatibility with old script names. Add rename_tex_to_dirname script
(moved from ~/bin). Update README and wiki page to reflect new setup.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-29 10:31:08 -07:00
parent 86fbf0f0a6
commit 3b444f70fc
8 changed files with 296 additions and 100 deletions

22
rename_tex_to_dirname Executable file
View File

@@ -0,0 +1,22 @@
#!/bin/bash
set -e
TARGET="$(basename "$(pwd)").tex"
if [ -e "$TARGET" ]; then
echo "error: '$TARGET' already exists"
exit 1
fi
files=(*.tex)
if [ "${files[0]}" = "*.tex" ]; then
echo "error: no .tex files found"
exit 1
fi
if [ "${#files[@]}" -gt 1 ]; then
echo "error: multiple .tex files found: ${files[*]}"
exit 1
fi
mv "${files[0]}" "$TARGET"