Quote from: b1b1 on September 23, 2012, 10:49:04Quote from: Diego on September 03, 2012, 07:54:13
I would use mktemp instead of a hardcoded file name. This way two print jobs can be sent at the same time without messing.
It's not hardcoded. It appends $$ (the shell's PID) to create a unique filename. mktemp may be useful though, if you are concerned about malicious users mounting a timing attack on the filename.
A better solution would be to avoid a temporary file, buffer the output header in memory, then write when the rest of the data starts flowing. Maybe dd could do this, or maybe a little Python script...
Sorry on my mistake. My bash scripting abilities are somewhat rusty. Reading bash man page again is in my to-do list.