#!/bin/bash

cd "$(dirname "$0")"

git pull

/usr/bin/pdflatex -file-line-error -interaction nonstopmode -jobname=All4 All4.tex
/usr/bin/pdflatex -file-line-error -interaction nonstopmode -jobname=All4 All4.tex
rm All4.aux All4.out All4.toc
mv All4.pdf /home/david/fileshare/Anders/

cd book-1
/usr/bin/pdflatex -file-line-error -interaction nonstopmode -jobname=Book1 "Main.tex"
/usr/bin/pdflatex -file-line-error -interaction nonstopmode -jobname=Book1 "Main.tex"
rm Book1.aux Book1.out Book1.toc
mv Book1.pdf /home/david/fileshare/Anders/

cd ../book-2
/usr/bin/pdflatex -file-line-error -interaction nonstopmode -jobname=Book2 "Main.tex"
/usr/bin/pdflatex -file-line-error -interaction nonstopmode -jobname=Book2 "Main.tex"
rm Book2.aux Book2.out Book2.toc
mv Book2.pdf /home/david/fileshare/Anders/

cd ../book-3
/usr/bin/pdflatex -file-line-error -interaction nonstopmode -jobname=Book3 "Main.tex"
/usr/bin/pdflatex -file-line-error -interaction nonstopmode -jobname=Book3 "Main.tex"
rm Book3.aux Book3.out Book3.toc
mv Book3.pdf /home/david/fileshare/Anders/

cd ../book-4
/usr/bin/pdflatex -file-line-error -interaction nonstopmode -jobname=Book4 "Main.tex"
/usr/bin/pdflatex -file-line-error -interaction nonstopmode -jobname=Book4 "Main.tex"
rm Book4.aux Book4.out Book4.toc
mv Book4.pdf /home/david/fileshare/Anders/
