Полезная информация

UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 43.4 Using Different Printers Chapter 43
Next: 43.6 Printing to a Terminal Printer

43.5 Using Symbolic Links for Spooling

When you print a file, the file is copied to a "spooling directory." This can be a problem if you want to print a very large file: the copy operation might take a long time, or the act of copying might fill the spooling directory's filesystem.

On BSD UNIX systems, the lpr command provides a workaround for this problem. The -s option makes a symbolic link (18.4) to your file from the spooling directory.

Here's such a command:

% lpr -s directions

Rather than copying directions, lpr creates a symbolic link to directions. The symbolic link is much faster, and you're unlikely to get a "filesystem full" error.

Using a symbolic link has one important side effect. Because the file isn't hidden away in a special spooling directory, you can delete or modify it after you give the lpr command, and before the printer is finished with it. This can have interesting side effects; be careful not to do it.

Of course, this warning applies only to the file that actually goes to the printer. For example, when you format a troff (43.13) file for a PostScript printer, you can continue to modify the troff file. If the PostScript file is spooled with lpr -s, you'd have to be careful about it. However, this isn't likely to be a problem. Most users use some kind of formatting script to run troff, and the formatting script prevents you from seeing, or mucking with, the PostScript file.

- ML

Previous: 43.4 Using Different Printers UNIX Power ToolsNext: 43.6 Printing to a Terminal Printer
43.4 Using Different Printers Book Index43.6 Printing to a Terminal Printer

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