[Gloucs] bash question

Iain Calder iain.calder at gmail.com
Tue Nov 30 21:06:30 UTC 2010


How about using xargs for the first requirement, e.g.:

find *.pdf | xargs gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -q
-sOutputFile=outputfile.pdf


On 30 November 2010 20:43, Glyn Davies <glynd at walmore.com> wrote:

> 'lo
>
> Any suggestions on how to do the following?
>
> I have a directory full of pdfs and I want to concatenate them into
> one large pdf.
>
> ghostscript can do this but the command is basically:
>
> gs -o outputfile.pdf   infile1.pdf   infile2.pdf
>
> So a script is in order (there's more pdfs than I'd like to do by hand)
>
> Every time I try to tackle something like this I end up with a counter
> (say n) and end up with the following problem:
>
> if n is 1, $n returns 1. I want to use n to cycle through the command
> line arguments so I end up with $$n the idea being $1 is the first
> command line argument so $n would return 1, leaving $1 which return
> the 1st command line argument.
>
> Now, I know this is wrong and won't work but no matter what (), {}, %
> and ` I put I can make it do what I want. How do you do it (assuming
> you can).
>
> So two problems there but the first reintroduced me to the latter.
>
> --
> Best Regards
> Glyn Davies
>
> _______________________________________________
> gloucs mailing list
> gloucs at mailman.lug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/gloucs
>


More information about the gloucs mailing list