-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtp
executable file
·56 lines (47 loc) · 905 Bytes
/
tp
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
#!/bin/sh
# script by Eric Stein http://cons.truct.org
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
TXT=$1
PDF=$2
H=markdown
PS=html2ps
PD=ps2pdf
if [ ! -f "$TXT" ]
then
exit "$TXT does not exist"
exit 1
fi
touch "$PDF"
if [ ! -f "$PDF" ]
then
exit "$PDF could not be created"
exit 1
fi
which $H>/dev/null
if [ $? -gt 0 ]
then
echo "$H is not a program."
exit 1
fi
which $PD>/dev/null
if [ $? -gt 0 ]
then
echo "$PD is not a program."
exit 1
fi
which $PS>/dev/null
if [ $? -gt 0 ]
then
echo "$PS is not a program."
exit 1
fi
$H "$TXT"|$PS|$PD - "$PDF"
if [ $? -gt 0 ]
then
echo "Failed to process."
exit 1
fi