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

📄 ch20_11.htm

📁 the unix power tools
💻 HTM
字号:
<HTML><!--Distributed by F --><HEAD><TITLE>[Chapter 20] 20.11 Getting tar's Arguments in the Right Order </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:45:02Z"><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="ch20_01.htm"TITLE="20. Backing Up Files"><LINKREL="prev"HREF="ch20_10.htm"TITLE="20.10 Avoid Absolute Paths with tar "><LINKREL="next"HREF="ch20_12.htm"TITLE="20.12 Protecting Files with SCCS or RCS "></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="ch20_10.htm"TITLE="20.10 Avoid Absolute Paths with tar "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 20.10 Avoid Absolute Paths with tar "BORDER="0"></A></TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><B><FONTFACE="ARIEL,HELVETICA,HELV,SANSERIF"SIZE="-1">Chapter 20<BR>Backing Up Files</FONT></B></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch20_12.htm"TITLE="20.12 Protecting Files with SCCS or RCS "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 20.12 Protecting Files with SCCS or RCS "BORDER="0"></A></TD></TR></TABLE>&nbsp;<HRALIGN="LEFT"WIDTH="515"TITLE="footer"></DIV><DIVCLASS="SECT1"><H2CLASS="sect1"><ACLASS="title"NAME="UPT-ART-0346">20.11 Getting tar's Arguments in the Right Order </A></H2><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-22608"></A><EMCLASS="emphasis">tar</EM>'s command line is one of UNIX's little mysteries. It'sdifficult to associate arguments with options. Let's sayyou want to specify the block size (<EMCLASS="emphasis">b</EM>), the output file(<EMCLASS="emphasis">f</EM>&nbsp;), and an &quot;exclude&quot; file (<EMCLASS="emphasis">X</EM>). Where do you put all thisinformation? It's easy enough to stick the option letters into a lumpand put them into a command (<CODECLASS="userinput"><B>tar&nbsp;cXbf</B></CODE>). But where do you putthe block size, the name of the exclude file, and so on?</P><PCLASS="para">List any arguments that you need <EMCLASS="emphasis">after</EM> the block of key letters.You must place the arguments in the <EMCLASS="emphasis">same order</EM> as the keyletters, as shown in<ACLASS="xref"HREF="ch20_11.htm#UPT-ART-346-FIG-0"TITLE="tar Options and Arguments">Figure 20.1</A>.</P><H4CLASS="figure"><ACLASS="title"NAME="UPT-ART-346-FIG-0">Figure 20.1: tar Options and Arguments</A></H4><IMGCLASS="graphic"SRC="figs/0346a.gif"ALT="Figure 20.1"><PCLASS="para">In this command, <EMCLASS="emphasis">keepout</EM> goes with the <EMCLASS="emphasis">X</EM> option, <EMCLASS="emphasis">20</EM> goeswith the <EMCLASS="emphasis">b</EM> option, and <EMCLASS="emphasis">archive.shar</EM> goes with the <EMCLASS="emphasis">f</EM>option. If we put the options in a different order, we also have toput the arguments in a different order (see<ACLASS="xref"HREF="ch20_11.htm#UPT-ART-346-FIG-1"TITLE="The Same Command, Rearranged">Figure 20.2</A>).</P><H4CLASS="figure"><ACLASS="title"NAME="UPT-ART-346-FIG-1">Figure 20.2: The Same Command, Rearranged</A></H4><IMGCLASS="graphic"SRC="figs/0346b.gif"ALT="Figure 20.2"><PCLASS="para">Note that the files you want to put on the tape (or the files you wantto extract from the tape) always go at the <EMCLASS="emphasis">end</EM> of the command.These are not arguments to <EMCLASS="emphasis">c</EM> or <EMCLASS="emphasis">X</EM>; they are part of thecommand itself.</P><PCLASS="para">The <EMCLASS="emphasis">dump</EM> command and a few others work the same way.</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="ch20_10.htm"TITLE="20.10 Avoid Absolute Paths with tar "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 20.10 Avoid Absolute Paths with tar "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="ch20_12.htm"TITLE="20.12 Protecting Files with SCCS or RCS "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 20.12 Protecting Files with SCCS or RCS "BORDER="0"></A></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172">20.10 Avoid Absolute Paths with tar </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">20.12 Protecting Files with SCCS or RCS </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 + -