-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathglue_pdfs
More file actions
26 lines (26 loc) · 733 Bytes
/
glue_pdfs
File metadata and controls
26 lines (26 loc) · 733 Bytes
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
#!/bin/bash
## Simple shell script to glue pdf-files into a single book
## Uses: gs (ghostscript), mktemp, find, read
## No any checks so fails are possible.
## Author Andrew S. [github,gitlab].com/quarkscript/ Licence GPL
list=$(echo $(find -name "*.pdf" | sed 's@\.\/@"@g' | sort -n)'"' | sed 's@ "@" "@g')
echo ''
echo $list
echo ''
read -p "Is sequence a correct? (y/n) " isrun
if [ "$isrun" == "y" ]; then
if [ -f book.pdf ]; then
bookname=$(mktemp book-XXXXXXX.pdf)
else
bookname='book.pdf'
fi
echo ''
gs -o "$bookname" -sDEVICE=pdfwrite -f $list
echo ''
echo New book name is $bookname
echo ''
else
echo ''
echo You may rename some files and run $0 again
echo ''
fi