UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 43.5 Using Symbolic Links for Spooling Chapter 43
Printing
Next: 43.7 Quick-and-Dirty Formatting Before Printing
 

43.6 Printing to a Terminal Printer

Does your terminal have an extra port on the back for plugging in a printer? You might be able to hook up a serial printer to the port. Then you can make a little shell script named something like myprint and use it this way:

% myprint somefile
% someprogram | myprint

The myprint shell script can be as simple as this:

echo "\033[5i\c"
cat $*
echo "\033[4i\c"

or this:

escape=`echo -n e | tr e '\033'`
echo -n "$escape[5i"
cat $*
echo -n "$escape[4i"

depending on what version of echo your UNIX has . (46.10) Your terminal may need different escape sequences; these are for a VT100-compatible terminal. (Articles 41.10 and 5.2 can help.) Some terminals may require a newline after the escape sequences; if yours doesn't work, try the echo commands without the /c or -n. If your printer seems to lose characters, you may have flow-control problems. Try using a slower data rate to the terminal.

- JP


Previous: 43.5 Using Symbolic Links for Spooling UNIX Power ToolsNext: 43.7 Quick-and-Dirty Formatting Before Printing
43.5 Using Symbolic Links for Spooling Book Index43.7 Quick-and-Dirty Formatting Before Printing

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System


Banner.Novgorod.Ru