This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: lpr works? FAQ in error?


"jrsyangl" <jrsy.angl@verizon.net> wrote:

> As a follow-up and clarification to my previous post, what I would like 
> to be able to do is to pipe output to a printer, e.g.
>  ls -l | lpr
> This doesn't work for me as I explained previously. Using notepad /P 
> instead of lpr doesn't work either.

It surely won't. You cannot feed text into notepad via a pipe.
To print via notepad, you need to write the output of "ls -l" to a file
then print this file via notepad.
Next problem: I have set up cygwin to use unix style line endings as
default. Now if I 
ls -l > tmp_file
and open tmpfile in notepad, notepad doesn't recognize the line endings,
at least not on screen. It nevertheless prints out correctly on my
printer, maybe because the printer itself interprets the line endings
correctly. But it may be better to use another editor instead,
perhaps pfe or pspad.
I ended up using a script -- you may need to modify it for your needs.
Assume you save this script as "abc", then you can call
abc ls -l 
and the script will execute the command "ls -l" and print its output via
notepad.
--------------snip-------------
#!/bin/sh 
$1 $2 $3 $4 $5 > tmp_file
/cygdrive/c/windows/notepad.exe /p tmp_file
rm tmp_file
--------------snip-------------

--
Wilfried Hennings


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]