且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Linux bash为pdfunite提供了参数

更新时间:2023-11-27 17:49:10

1 其中包含结果.pdf



我想将所有这些单页pdf文件合并为一个多页pdf文件。那里有 pdfunite 。代码片段的第一行在屏幕上打印脚本尝试执行的内容,第二行就是这样(或者我认为)。
 echo pdfunite


PAGES


1
pdfunite


Hi forum,

a bash script I wrote behaves unexpectedly (read: "There's a bug in it.") and I just don't get it.

Say there's that variable PAGES which contains " page0.pdf page1.pdf page2.pdf". And there is $1 which contains "result.pdf".

I want to merge all those single-page pdf files into one multi-page pdf file. There's pdfunite for that. The first line of the code snippet prints to the screen what the script is trying to execute, the second line does just that (or so I thought).

echo pdfunite "$PAGES" "$1"
pdfunite "$PAGES" "$1"

At that point, pdfunite prints its help message. Therefore I guess that something is wrong with the arguments I gave it.
But when I copy the output of the first line to the command prompt of the very terminal the script ran in, it pdfunites everything together perfectly.

So: Where's the difference in executing something (which does not work) to printing it to the console and copying it onto a new line to execute (which does work)?

What I have tried:

Printed the command in question to the console before actually executing it. And tried to execute the printed-out version (which actually works).

1 which contains "result.pdf".

I want to merge all those single-page pdf files into one multi-page pdf file. There's pdfunite for that. The first line of the code snippet prints to the screen what the script is trying to execute, the second line does just that (or so I thought).
echo pdfunite "


PAGES" "


1" pdfunite "