forked from apuntes-uam-infomat/apuntes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compilar.sh
executable file
·72 lines (62 loc) · 1.56 KB
/
compilar.sh
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
install=true
logfile="compilar.log"
makelatex() {
includes="../Cosas guays LaTeX"
cd "$1"
if $install ; then
echo "Copiando archivos temporales..."
cp $includes/*.sty ./
cp $includes/*.cls ./
fi
echo "Compilando $1"
latexmk -pdf -silent >> $logfile 2>&1 && cp *.pdf ../output || echo -e ">>>>>>>> \e[31mError \e[mprocesando \e[34m$1\e[m <<<<<<<<"
if $install ; then
echo "Eliminando archivos temporales..."
rm *.sty
rm *.cls
fi
cd -
}
read -p "Instalar paquetes (opcional)? (y/n) " iyn
case $iyn in
[Yy]* ) echo "Instalando paquetes.."
echo "-----------------------------------------"
cd "Cosas guays LaTeX"
sudo ./install > /dev/null
cd ..
install=false;;
esac
read -p "Compilar (y/n)? " yn
case $yn in
[Yy]* ) echo "Compilando..."
echo > $logfile
mkdir -p output
echo "-----------------------------------------"
IFS=$'\n'
for dir in `ls`
do
if [[ -d "$dir" && "$dir" != *LaTeX && "$dir" != "output" ]]; then
makelatex "$dir"
fi
done
;;
[Nn]* ) echo "Ok";;
* ) echo "???";;
esac
echo "-----------------------------------------"
read -p "Copiar? (y/n)? " yn
case $yn in
[Yy]* ) if [ $USER="vicdejuan" ]
then
echo "Eres dejuan y me se tu directorio"
cp output/*.pdf /home/vicdejuan/Compartido/Dropbox/Doble\ Grado\ UAM\ \(1\)/TERCEROGILIS/Primer\ Cuatrimestre/Apuntes\ Latex/
else
echo "Escribe el path donde quieres copiar los pdfs (a partir de home):"
read directory
cp output/*.pdf ~/$directory/
fi
echo "Listo."
;;
* ) echo "Ok";;
esac