Re: [SLUG] A simple script and printing question (?)

From: Eben King (eben1@tampabay.rr.com)
Date: Wed Apr 12 2006 - 21:39:10 EDT


On Wed, 12 Apr 2006, Macy1 Hallock wrote:

> A simple question for our SLUG bash wizards...
>
> I'm hacking a vendors ancient COBOL program output to print using lpr (via
> cups) in Fedora.
>
> Given a program output similar to that produced by "cat textfile.txt >"
> If I append the sting "/dev/ttyS01" it prints to the serial port. But I want
> to print using the cups spooler. I can't using lpr, because the pipe
> metacharacter won't function.
>
> So, how can I print the stdout via lpr under cups, not using a pipe?
>
> Note that I can't modify the command shown in quotes, I can only append to
> it, and there's a 15 character field limit to boot.
>
> Ideas, anyone?

Dump to a temp file, and print that? "cat textfile.txt >/tmp/x;lpr x" will
fit (10 chars) and sorta work. Unless /tmp/x already exists. Don't know a
way to cram even basic security in 15 chars.

Well, you could do something like this beforehand:

mkfifo /tmp/cobol-lpr-pipe
chmod 660 /tmp/cobol-lpr-pipe
lpr /tmp/cobol-lpr-pipe &

then run

...
cat textfile.txt > /tmp/cobol-lpr-pipe
...

Might work...

-- 
"The Web brings people together because no matter what kind of a twisted
  sexual mutant you happen to be, you've got millions of pals out there.
  Type in 'Find people that have sex with goats that are on fire' and the
  computer will say, 'Specify type of goat.'" -- Rich Jeni
-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS).  Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 17:26:33 EDT