home | list info | list archive | date index | thread index

Re: [OCLUG-Tech] Re: ps2pdf and xargs

On Tue, Sep 20, 2005 at 08:56:00AM -0800, J C Nash wrote:

> I wanted to convert all the ps files in a directory, so
> tried
> 
> ls *.ps | xargs ps2pdf
> 
> but got the "usage" msg from ps2pdf. Tried a few alternative
> with no joy and finally wrote a perl script that does a nice
> job (available on request). However, I'd like to know why
> xargs doesn't work here.

ps2pdf doesn't take multiple .ps files as command line arguments (it
only operates on one .ps file at a time).  To run ps2pdf once for each
.ps, you want something more like:

ls *.ps | xargs -n 1 ps2pdf

This will make xargs use no more than one argument for each invocation
of ps2pdf.

Cheers,

Kevin.

references

message navigation