-
Notifications
You must be signed in to change notification settings - Fork 2
/
job-me
executable file
·98 lines (78 loc) · 1.96 KB
/
job-me
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/bin/sh
# Originally created by Hamilton Turner
# hamiltont<at>gmail.com on May 8 2012.
# Feel free to use/modify, but please
# leave this attribution unchanged
# TODO monitor the error output of all commands and
# print the output if we hang or an error is thrown.
# See if there are parameters for the subcommands that
# assist in scripting, instead of always falling back
# on user input in case of error
file="resume"
outfile="hamilton-turner.pdf"
debug=false
issilent=true
# Allows us to hide all output
function silent() {
if $issilent ;
then
"$@" > /dev/null 2>&1;
else
"$@";
fi
}
# Remove temporary files if we're not debugging
function clean {
if $debug ;
then
return 0
fi
# Remove all the standard files
silent rm *.aux *.bbl *.ps *.blg *.dvi *.log *.out
# Remove the files that bibtoic generates
silent rm $file*.bbl
}
while getopts "dvc" OPT
do
case $OPT in
d) debug=true;;
v) issilent=false;;
c) clean
exit 0;;
[?]) echo "
Usage: $0 [-d] [-v] [-c] <tex file>
This script builds my resume, by default hiding subcommand
output and cleaning up after itself.
OPTIONS:
-d Debugging. Temporary files are not removed
-v Verbose e.g. subcommand output is printed
-c Clean temporary files and exit.
"
exit 1;;
esac
done
# Pick up the filename. This only really handles proper usage,
# I don't totally understand the argument handling here
if [ -z ${@:$OPTIND} ]
then
echo "No filename passed, assuming 'resume'"
else
file = ${@:$OPTIND}
fi
clean
echo "latex: Created AUX files"
silent latex "$file"
echo "bibtex: Bibliography databases..."
for bib in `ls $file*.bbl`; do
echo "bibtex: Processing ${bib%.bbl}"
silent bibtex "${bib%.bbl}"
done
echo "latex: Inserting bibliographic references for citations"
silent latex "$file"
echo "latex: Reformatting with citations included"
silent latex "$file"
echo "dvips: Creating postscript"
silent dvips "$file"
echo "ps2pdf: Creating PDF"
silent ps2pdf "$file.ps" "$outfile"
clean