What you really
should be using is standard shell globbing
. That's the preferred way to build a command line with multiple files.
Beware though, as you've discovered, that the files will expand in ascii sorting order, which means that "10" will probably come just after "1", instead of "9". You have to get a bit fancy if you want to match non-zero-padded names with globs.
pdfunite tmp[1-9].pdf tmp1[0-9].pdf tmp2[0-9].pdf ... final.pdf
So you should really get into the habit of always zero-padding numbers in your filenames. "10" will always follow "09". With zero padding, the command would look like this (assuming 2 digits):
pdfunite tmp[0-9][0-9].pdf final.pdf
, as tange posted above, can be used as well, and is a good way to deal with files that aren't zero-padded. It does have a drawback, however. Since the whole list of possible filenames is built first, any entries that don't match an actual filename will probably give you "file not found" errors.
globbing doesn't have this problem, as it only expands into files that actually exist. Do note however that if a glob matches nothing, the shell will try to use the raw string as is, unless the nullglob
shell options are set.