[Chapter 43] 43.6 Printing to a Terminal Printer
Author: Jerry Peek, Tim O'Reilly & Mike Loukides
Date: 1998-10-23T15:51:45Z

#

| Chapter 43 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

43.5 Using Symbolic Links for Spooling |  | 43.7 Quick-and-Dirty Formatting Before Printing