Putting multiple arguments into a single variable doesn't make sense. Instead, put them into an array:
args=(combined.pdf "my file.pdf");
Notice that "my file.pdf"
is quoted to preserve whitespace.
You can use the array like this:
pdftk "${args[@]}" ...
This will pass two separate arguments to pdftk
. The quotes in "${args[@]}"
are required because they tell the shell to treat each array element as a separate "word" (i.e. do not split array elements, even if they contain whitespace).
As a side note, if you use bash
isms like arrays, change your shebang to
#!/bin/bash