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:
22
rename_tex_to_dirname
Executable file
22
rename_tex_to_dirname
Executable 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"
|
||||
Reference in New Issue
Block a user