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>
23 lines
376 B
Bash
Executable File
23 lines
376 B
Bash
Executable File
#!/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"
|