Created
June 8, 2015 08:43
-
-
Save karthikraman/ebc15ad05b1257aa8123 to your computer and use it in GitHub Desktop.
Join PDF files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ $# -eq 0 ]] | |
then | |
echo "Usage: `basename $0` <output file> <input files>" | |
exit 1 | |
fi | |
ofile=$1 | |
if [[ -f $ofile ]] | |
then | |
echo "Output file $ofile already exists; cowardly refusing to overwrite. Quitting!" | |
echo "Usage: `basename $0` <output file> <input files>" | |
exit 1 | |
fi | |
shift | |
echo "Joining files:" | |
echo "--------------------------------" | |
for x in $* | |
do | |
echo $x | |
done | |
echo "--------------------------------" | |
echo -ne "to: " $ofile ... | |
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=$ofile $* | |
echo DONE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment