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 . () Your terminal may need different escape sequences; these are for a VT100-compatible terminal. (Articles and 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