>>>>> "Chris" == Chris Allen <[email protected]> writes:

Chris> I need to merge several sets of PDF files into a single PDF
Chris> file For example want to merge the files


spaces in file names are difficult to handle, especially when you have
multiple levels of quoting.

Chris> To make life easier I created the following shell script

Chris> #bash echo echo $0 echo $1.pdf echo \"$2\"* echo echo gs
Chris> -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=$1.pdf
Chris> \"$2\"* echo gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite
Chris> -sOutputFile=$1.pdf \"$2\"*

That needs to be "$2" withput the backslashes.

I'd actually want to do something like:

#!/bin/sh
output="$1"
shift
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite  -sOutputFile="$output" "$@"

and list all the filenames (properly quoted) on the command line to
the script, thus:
        pdfmerge outfile.pdf "a .b.c .pdf" "foo bah .pdf"
etc

In general, I'd avoid file names with spaces or tabs in them.  There
are too many badly-written scripts in the wild that will do the wrong
thing with them.

Peter C
--
Dr Peter Chubb  http://www.gelato.unsw.edu.au  peterc AT gelato.unsw.edu.au
http://www.ertos.nicta.com.au           ERTOS within National ICT Australia

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to