If an ordinary user tries to write to lp0, this is the result:
$ cat > /dev/lp0
bash: /dev/lp0: Permission denied
Using a large club results in this:
$ su root -c "cat > /dev/lp0"
$ ls -l /dev/lp*
-rw-r--r-- 1 root root 11 Mar 11 11:49 /dev/lp0
$ cat /dev/lp0
i.e. /dev/lp0 has been overwritten.
1. Get CUPS to a point where "lpr -p some.txt" prints a date-stamped
some.txt (see man CUPS and man lpr).
2. Get your program printing to STDOUT
3. Pipe to lpr
Handling print queues is the OS' job, not the application's.
On 3/10/19, ToddAndMargo via perl6-users <firstname.lastname@example.org> wrote:
> >> Hi All,
> >> How do I output data to a printer on /dev/lp0 (LPT1)?
> >> Many thanks,
> >> -T
> On 3/10/19 11:28 AM, Parrot Raiser wrote:
>> Do you have the printer set up in CUPS? (Common Unix Printing System.)
>> See "man cups".
>> Applications shouldn't normally be writing to explicit device IDs.
>> On 3/10/19, ToddAndMargo via perl6-users <email@example.com> wrote:
> Hi Parrot,
> I mean writing directly to /dev/lp0.
> This is my example that does not work as I have a kernel problem
> with lp0 at the moment:
> p6 '"/dev/lp0".IO.spurt( "abc"~chr(12) );'
> But it would also be nice to know how to write to cups as well
> for my notes.