I would like to define a simple abbreviation of a call to gs
(ghostscript) via a shell script. The first argument(s) give all the files that should be merged, the last one gives the name of the output file. Obviously, the following does not work (it's just for showing the goal):
#!/bin/sh
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOUTPUTFILE=$last $1 $2 ...
How can this be done?
One would typically call this script via myscript infile1.pdf infile2.pdf ... outfile.pdf
or myscript *.pdf outfile.pdf
.