⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch43_04.htm

📁 the unix power tools
💻 HTM
字号:
<HTML><!--Distributed by F --><HEAD><TITLE>[Chapter 43] 43.4 Using Different Printers </TITLE><METANAME="DC.title"CONTENT="UNIX Power Tools"><METANAME="DC.creator"CONTENT="Jerry Peek, Tim O'Reilly &amp; Mike Loukides"><METANAME="DC.publisher"CONTENT="O'Reilly &amp; Associates, Inc."><METANAME="DC.date"CONTENT="1998-10-23T15:51:43Z"><METANAME="DC.type"CONTENT="Text.Monograph"><METANAME="DC.format"CONTENT="text/html"SCHEME="MIME"><METANAME="DC.source"CONTENT="1-56592-260-3"SCHEME="ISBN"><METANAME="DC.language"CONTENT="en-US"><METANAME="generator"CONTENT="Jade 1.1/O'Reilly DocBook 3.0 to HTML 4.0"><LINKREV="made"HREF="mailto:online-books@oreilly.com"TITLE="Online Books Comments"><LINKREL="up"HREF="ch43_01.htm"TITLE="43. Printing"><LINKREL="prev"HREF="ch43_03.htm"TITLE="43.3 Printer Control with lpc "><LINKREL="next"HREF="ch43_05.htm"TITLE="43.5 Using Symbolic Links for Spooling "></HEAD><BODYBGCOLOR="#FFFFFF"TEXT="#000000"><DIVCLASS="htmlnav"><H1><IMGSRC="gifs/smbanner.gif"ALT="UNIX Power Tools"USEMAP="#srchmap"BORDER="0"></H1><MAPNAME="srchmap"><AREASHAPE="RECT"COORDS="0,0,466,58"HREF="index.htm"ALT="UNIX Power Tools"><AREASHAPE="RECT"COORDS="467,0,514,18"HREF="jobjects/fsearch.htm"ALT="Search this book"></MAP><TABLEWIDTH="515"BORDER="0"CELLSPACING="0"CELLPADDING="0"><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch43_03.htm"TITLE="43.3 Printer Control with lpc "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 43.3 Printer Control with lpc "BORDER="0"></A></TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><B><FONTFACE="ARIEL,HELVETICA,HELV,SANSERIF"SIZE="-1">Chapter 43<BR>Printing</FONT></B></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch43_05.htm"TITLE="43.5 Using Symbolic Links for Spooling "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 43.5 Using Symbolic Links for Spooling "BORDER="0"></A></TD></TR></TABLE>&nbsp;<HRALIGN="LEFT"WIDTH="515"TITLE="footer"></DIV><DIVCLASS="SECT1"><H2CLASS="sect1"><ACLASS="title"NAME="UPT-ART-1176">43.4 Using Different Printers </A></H2><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-47635"></A>Each printer on your system should have a name. By default, commands that send a file to a printer assume that the printer is named <EMCLASS="emphasis">lp</EM>-which probably stands for &quot;lineprinter&quot; (though it could stand for &quot;laser printer&quot;).If you're usinga single-user workstation, and have a printer connected directly toyour workstation, you can name your printer <EMCLASS="emphasis">lp</EM> and forget aboutit.</P><PCLASS="para">However, in most environments, there are more options available: e.g.,there are several printers in different parts of the building that youcan choose from.Often, only one printer will be able to print yourdocuments: you may need to send your print jobs to a PostScriptprinter, not the line printer that the accounting department uses forbilling.</P><PCLASS="para">There are two ways to choose a printer:</P><ULCLASS="itemizedlist"><LICLASS="listitem"><PCLASS="para">Printing commands that originate with BSD UNIX acceptthe option <CODECLASS="literal">-P</CODE><CODECLASS="replaceable"><I>printer</I></CODE>.This includes<SPANCLASS="link"><EMCLASS="emphasis">lpr</EM> (<ACLASS="linkend"HREF="ch43_02.htm"TITLE="Introduction to Printing on UNIX ">43.2</A>)</SPAN>,variousscripts to format typeset documents, etc.For example, <CODECLASS="literal">lpr&nbsp;-Pps&nbsp;file.ps</CODE>sends the file <EMCLASS="emphasis">file.ps</EM> to the printer named <EMCLASS="emphasis">ps</EM>.(By the way, <EMCLASS="emphasis">ps</EM> is probably the second most common printer name,after <EMCLASS="emphasis">lp</EM>.)</P></LI><LICLASS="listitem"><PCLASS="para">Commands that originate with BSD UNIX recognize the <EMCLASS="emphasis">PRINTER</EM> <SPANCLASS="link">environment variable (<ACLASS="linkend"HREF="ch06_01.htm#UPT-ART-1170"TITLE="What Environment Variables Are Good For ">6.1</A>)</SPAN>;if <EMCLASS="emphasis">PRINTER</EM> is defined, the command will read its value and choose aprinter accordingly.So the command:</P><PCLASS="para"><BLOCKQUOTECLASS="screen"><PRECLASS="screen">% <CODECLASS="userinput"><B>setenv PRINTER ps</B></CODE> <ICLASS="lineannotation">&nbsp;- or</I>$ <CODECLASS="userinput"><B>PRINTER=ps ; export PRINTER</B></CODE></PRE></BLOCKQUOTE></P><PCLASS="para">ensures that the BSD print commands will send your documents to theprinter named <EMCLASS="emphasis">ps</EM>.</P></LI><LICLASS="listitem"><PCLASS="para">Commands that originate with System V UNIX (such as <EMCLASS="emphasis">lp</EM>) use the<EMCLASS="emphasis">-d</EM> option to select a printer.So <CODECLASS="literal">lp&nbsp;-d&nbsp;pr&nbsp;file.ps</CODE> sends<EMCLASS="emphasis">file.ps</EM> to the printer named <EMCLASS="emphasis">pr</EM>; it's equivalent to theprevious <EMCLASS="emphasis">lpr</EM> example.</P></LI><LICLASS="listitem"><PCLASS="para">Commands that originate with System V UNIX look for an environmentvariable named <EMCLASS="emphasis">LPDEST</EM>, rather than <EMCLASS="emphasis">PRINTER</EM>.So: </P><PCLASS="para"><BLOCKQUOTECLASS="screen"><PRECLASS="screen">% <CODECLASS="userinput"><B>setenv LPDEST ps</B></CODE> <ICLASS="lineannotation">&nbsp;- or</I>$ <CODECLASS="userinput"><B>LPDEST=ps ; export LPDEST</B></CODE></PRE></BLOCKQUOTE></P><PCLASS="para">&#13;ensures that the System V print commands will send your documents tothe printer named <EMCLASS="emphasis">ps</EM>.</P></LI></UL><PCLASS="para">Note that System V Release 4 includes both the System V and BSDprint commands (<EMCLASS="emphasis">lp</EM> and <EMCLASS="emphasis">lpr</EM>).This can make thingsconfusing, particularly if you're using a script to process<EMCLASS="emphasis">troff</EM> or TeX documents, and that script automatically sends yourdocuments to the printer.Unless you know how the script works,you won't know which variable to set.I'd suggestsetting both<EMCLASS="emphasis">PRINTER</EM> and <EMCLASS="emphasis">LPDEST</EM>.</P><PCLASS="para">By the way, if you only have one printer, but you've given it somename other than <EMCLASS="emphasis">lp</EM>, the samesolution works: just set <EMCLASS="emphasis">PRINTER</EM> or <EMCLASS="emphasis">LPDEST</EM> to the appropriate name.</P><DIVCLASS="sect1info"><PCLASS="SECT1INFO">- <SPANCLASS="authorinitials">ML</SPAN></P></DIV></DIV><DIVCLASS="htmlnav"><P></P><HRALIGN="LEFT"WIDTH="515"TITLE="footer"><TABLEWIDTH="515"BORDER="0"CELLSPACING="0"CELLPADDING="0"><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch43_03.htm"TITLE="43.3 Printer Control with lpc "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 43.3 Printer Control with lpc "BORDER="0"></A></TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><ACLASS="book"HREF="index.htm"TITLE="UNIX Power Tools"><IMGSRC="gifs/txthome.gif"SRC="gifs/txthome.gif"ALT="UNIX Power Tools"BORDER="0"></A></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch43_05.htm"TITLE="43.5 Using Symbolic Links for Spooling "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 43.5 Using Symbolic Links for Spooling "BORDER="0"></A></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172">43.3 Printer Control with lpc </TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><ACLASS="index"HREF="index/idx_0.htm"TITLE="Book Index"><IMGSRC="gifs/index.gif"SRC="gifs/index.gif"ALT="Book Index"BORDER="0"></A></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172">43.5 Using Symbolic Links for Spooling </TD></TR></TABLE><HRALIGN="LEFT"WIDTH="515"TITLE="footer"><IMGSRC="gifs/smnavbar.gif"SRC="gifs/smnavbar.gif"USEMAP="#map"BORDER="0"ALT="The UNIX CD Bookshelf Navigation"><MAPNAME="map"><AREASHAPE="RECT"COORDS="0,0,73,21"HREF="../index.htm"ALT="The UNIX CD Bookshelf"><AREASHAPE="RECT"COORDS="74,0,163,21"HREF="index.htm"ALT="UNIX Power Tools"><AREASHAPE="RECT"COORDS="164,0,257,21"HREF="../unixnut/index.htm"ALT="UNIX in a Nutshell"><AREASHAPE="RECT"COORDS="258,0,321,21"HREF="../vi/index.htm"ALT="Learning the vi Editor"><AREASHAPE="RECT"COORDS="322,0,378,21"HREF="../sedawk/index.htm"ALT="sed &amp; awk"><AREASHAPE="RECT"COORDS="379,0,438,21"HREF="../ksh/index.htm"ALT="Learning the Korn Shell"><AREASHAPE="RECT"COORDS="439,0,514,21"HREF="../lrnunix/index.htm"ALT="Learning the UNIX Operating System"></MAP></DIV></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -