-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·72 lines (65 loc) · 1.22 KB
/
run.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
72
#!/bin/bash
verbose=false
ignore=false
pdf=false
biber=false
bibtex=false
xelatex=false
pdflatexCmd="pdflatex --output-directory=build/"
xelatexCmd="xelatex --output-directory=build/"
cmd=""
for parameter in $1 $2 $3 $4 $5 $6; do
if [ $parameter == "-verbose" ]; then
verbose=true
fi
if [ $parameter == "-pdf" ]; then
pdf=true
fi
if [ $parameter == "-ignore" ]; then
ignore=true
fi
if [ $parameter == "-xelatex" ]; then
xelatex=true
fi
if [ $parameter == "-biber" ]; then
biber=true
elif [ $parameter == "-bibtex" ]; then
bibtex=true
fi
done
#xelatex or pdflatex
if [ $xelatex == true ]; then
cmd=$xelatexCmd
else
cmd=$pdflatexCmd
fi
#ignore errors
if [ $ignore == true ]; then
cmd=$cmd' -interaction=nonstopmode'
fi
cmd=$cmd' main.tex'
#log
if [ $verbose == false ]; then
cmd=$cmd' > /dev/null 2>&1'
fi
#latex
eval $cmd
#biber
if [ $biber == true ]; then
eval 'biber build/main.bcf'
eval $cmd
fi
#bibtex
if [ $bibtex == true ]; then
eval 'bibtex build/main.aux'
eval $cmd
eval $cmd
fi
#PDF
if [ $pdf == true ]; then
if [[ "$ostype" == "linux-gnu"* ]]; then
nohup evince build/main.pdf > build/evince.log &
elif [[ "$ostype" == "darwin"* ]]; then
nohup open build/main.pdf > build/open.log &
fi
fi