-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuildPDF.sh
More file actions
executable file
·43 lines (38 loc) · 945 Bytes
/
buildPDF.sh
File metadata and controls
executable file
·43 lines (38 loc) · 945 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
w_dir=$(pwd)
find . -name "main.tex" | sed -e 's/\/main.tex//g' | sed -e 's/\.\///g' > .filesList
mkdir -p PDF
declare -A failed
i=0
echo "Inizio"
while IFS= read -r path || [ -n "$path" ]
do
docName="${path%"${path##*[!/]}"}"
docName="${docName##*/}"
echo ""
echo "Creazione $docName..."
cd "$path"
{
latexmk -pdf -quiet -interaction=nonstopmode main.tex
result=$?
cd "$w_dir"
if [ $result != 0 ]; then
failed[$i]=$docName
i=$i+1
continue
fi
} &> /dev/null
cp $path/main.pdf ./PDF/$docName.pdf
echo "File $docName.pdf creato correttamente."
done <.filesList
if [ $i != 0 ]; then
echo -e "\n The following documents could not be produced:"
printf ' - %s\n' "${failed[@]}"
exit 1
else
echo ""
echo "-----------"
echo ""
echo "Tutti i documenti sono stati creati correttamente."
fi
exit 0