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