The lpr man page states:
-hheader Specify a title to be used on the banner page (if any). Default title is the name of the file.
And nothing else concerning this (meaning, as it states: "Default title is the name of the file", as you didn't pass the -h
parameter). So it looks like a misbehaviour, at least at first sight. On a second look, I notice your -p
parameter:
-p Add pr(1) style headers to each page (text only)
Taking a look at the pr(1) man page:
use a centered HEADER instead of filename in page header, -h "" prints a blank line, don't use -h""
My guess would be that this "centered header" is only calculated once, instead for each file separately. So you could try your both approaches without the -p
parameter to check whether that introduces the problem -- or try a third approach:
for myfile in file*.txt; do lpr -p $myfile; done
which would invoke lpr
for each file separately, and thus get you rid of the described problem.