-
Notifications
You must be signed in to change notification settings - Fork 16
/
build.sh
executable file
·52 lines (50 loc) · 1.14 KB
/
build.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
#!/bin/bash
# Generate eps from Gnuplot. This gives nicer figures than using the png terminal in Gnuplot directly):
for f in `ls *.gnuplot`
do
gnuplot $f;
done;
while :
do
case "$1" in
-v | --pdf)
if hash epstopdf 2>/dev/null; then
for f in `ls *.eps`
do
epstopdf $f;
rm $f
done;
else
echo "No epstopdf, please install it. It should come with a LaTeX distribution."
fi
shift
;;
-b | --png)
if hash convert 2>/dev/null; then
for f in `ls *.eps`
do
convert -density 200 $f -flatten ${f%eps}png;
rm $f
done;
else
echo "Please install ImageMagick!"
fi
shift
;;
-h | --help)
echo "Usage: $0 [option]"
echo ""
echo " -v, --pdf Convert Gnuplot .eps files to PDF"
echo " -b, --png Convert Gnuplot .eps files to PNG"
exit 0
;;
-*)
echo "Error: Unknown option: $1" >&2
## or call function display_help
exit 1
;;
*) # No more options
break
;;
esac
done