?? wget.texi
字號:
@c man begin OPTIONS@node Option Syntax@section Option Syntax@cindex option syntax@cindex syntax of optionsSince Wget uses GNU getopt to process command-line arguments, everyoption has a long form along with the short one. Long options aremore convenient to remember, but take time to type. You may freelymix different option styles, or specify options after the command-linearguments. Thus you may write:@examplewget -r --tries=10 http://fly.srk.fer.hr/ -o log@end exampleThe space between the option accepting an argument and the argument maybe omitted. Instead of @samp{-o log} you can write @samp{-olog}.You may put several options that do not require arguments together,like:@examplewget -drc @var{URL}@end exampleThis is a complete equivalent of:@examplewget -d -r -c @var{URL}@end exampleSince the options can be specified after the arguments, you mayterminate them with @samp{--}. So the following will try to download@sc{url} @samp{-x}, reporting failure to @file{log}:@examplewget -o log -- -x@end exampleThe options that accept comma-separated lists all respect the conventionthat specifying an empty list clears its value. This can be useful toclear the @file{.wgetrc} settings. For instance, if your @file{.wgetrc}sets @code{exclude_directories} to @file{/cgi-bin}, the followingexample will first reset it, and then set it to exclude @file{/~nobody}and @file{/~somebody}. You can also clear the lists in @file{.wgetrc}(@pxref{Wgetrc Syntax}).@examplewget -X '' -X /~nobody,/~somebody@end exampleMost options that do not accept arguments are @dfn{boolean} options,so named because their state can be captured with a yes-or-no(``boolean'') variable. For example, @samp{--follow-ftp} tells Wgetto follow FTP links from HTML files and, on the other hand,@samp{--no-glob} tells it not to perform file globbing on FTP URLs. Aboolean option is either @dfn{affirmative} or @dfn{negative}(beginning with @samp{--no}). All such options share severalproperties.Unless stated otherwise, it is assumed that the default behavior isthe opposite of what the option accomplishes. For example, thedocumented existence of @samp{--follow-ftp} assumes that the defaultis to @emph{not} follow FTP links from HTML pages.Affirmative options can be negated by prepending the @samp{--no-} tothe option name; negative options can be negated by omitting the@samp{--no-} prefix. This might seem superfluous---if the default foran affirmative option is to not do something, then why provide a wayto explicitly turn it off? But the startup file may in fact changethe default. For instance, using @code{follow_ftp = off} in@file{.wgetrc} makes Wget @emph{not} follow FTP links by default, andusing @samp{--no-follow-ftp} is the only way to restore the factorydefault from the command line.@node Basic Startup Options@section Basic Startup Options@table @samp@item -V@itemx --versionDisplay the version of Wget.@item -h@itemx --helpPrint a help message describing all of Wget's command-line options.@item -b@itemx --backgroundGo to background immediately after startup. If no output file isspecified via the @samp{-o}, output is redirected to @file{wget-log}.@cindex execute wgetrc command@item -e @var{command}@itemx --execute @var{command}Execute @var{command} as if it were a part of @file{.wgetrc}(@pxref{Startup File}). A command thus invoked will be executed@emph{after} the commands in @file{.wgetrc}, thus taking precedence overthem. If you need to specify more than one wgetrc command, use multipleinstances of @samp{-e}.@end table@node Logging and Input File Options@section Logging and Input File Options@table @samp@cindex output file@cindex log file@item -o @var{logfile}@itemx --output-file=@var{logfile}Log all messages to @var{logfile}. The messages are normally reportedto standard error.@cindex append to log@item -a @var{logfile}@itemx --append-output=@var{logfile}Append to @var{logfile}. This is the same as @samp{-o}, only it appendsto @var{logfile} instead of overwriting the old log file. If@var{logfile} does not exist, a new file is created.@cindex debug@item -d@itemx --debugTurn on debug output, meaning various information important to thedevelopers of Wget if it does not work properly. Your systemadministrator may have chosen to compile Wget without debug support, inwhich case @samp{-d} will not work. Please note that compiling withdebug support is always safe---Wget compiled with the debug support will@emph{not} print any debug info unless requested with @samp{-d}.@xref{Reporting Bugs}, for more information on how to use @samp{-d} forsending bug reports.@cindex quiet@item -q@itemx --quietTurn off Wget's output.@cindex verbose@item -v@itemx --verboseTurn on verbose output, with all the available data. The default outputis verbose.@item -nv@itemx --no-verboseTurn off verbose without being completely quiet (use @samp{-q} forthat), which means that error messages and basic information still getprinted.@cindex input-file@item -i @var{file}@itemx --input-file=@var{file}Read @sc{url}s from @var{file}. If @samp{-} is specified as@var{file}, @sc{url}s are read from the standard input. (Use@samp{./-} to read from a file literally named @samp{-}.)If this function is used, no @sc{url}s need be present on the commandline. If there are @sc{url}s both on the command line and in an inputfile, those on the command lines will be the first ones to beretrieved. The @var{file} need not be an @sc{html} document (but noharm if it is)---it is enough if the @sc{url}s are just listedsequentially.However, if you specify @samp{--force-html}, the document will beregarded as @samp{html}. In that case you may have problems withrelative links, which you can solve either by adding @code{<basehref="@var{url}">} to the documents or by specifying@samp{--base=@var{url}} on the command line.@cindex force html@item -F@itemx --force-htmlWhen input is read from a file, force it to be treated as an @sc{html}file. This enables you to retrieve relative links from existing@sc{html} files on your local disk, by adding @code{<basehref="@var{url}">} to @sc{html}, or using the @samp{--base} command-lineoption.@cindex base for relative links in input file@item -B @var{URL}@itemx --base=@var{URL}Prepends @var{URL} to relative links read from the file specified withthe @samp{-i} option.@end table@node Download Options@section Download Options@table @samp@cindex bind address@cindex client IP address@cindex IP address, client@item --bind-address=@var{ADDRESS}When making client TCP/IP connections, bind to @var{ADDRESS} onthe local machine. @var{ADDRESS} may be specified as a hostname or IPaddress. This option can be useful if your machine is bound to multipleIPs.@cindex retries@cindex tries@cindex number of retries@item -t @var{number}@itemx --tries=@var{number}Set number of retries to @var{number}. Specify 0 or @samp{inf} forinfinite retrying. The default is to retry 20 times, with the exceptionof fatal errors like ``connection refused'' or ``not found'' (404),which are not retried.@item -O @var{file}@itemx --output-document=@var{file}The documents will not be written to the appropriate files, but allwill be concatenated together and written to @var{file}. If @samp{-}is used as @var{file}, documents will be printed to standard output,disabling link conversion. (Use @samp{./-} to print to a fileliterally named @samp{-}.)Use of @samp{-O} is @emph{not} intended to mean simply ``use the name@var{file} instead of the one in the URL;'' rather, it isanalogous to shell redirection:@samp{wget -O file http://foo} is intended to work like@samp{wget -O - http://foo > file}; @file{file} will be truncatedimmediately, and @emph{all} downloaded content will be written there.Note that a combination with @samp{-k} is only permitted whendownloading a single document, and combination with any of @samp{-r},@samp{-p}, or @samp{-N} is not allowed.@cindex clobbering, file@cindex downloading multiple times@cindex no-clobber@item -nc@itemx --no-clobberIf a file is downloaded more than once in the same directory, Wget'sbehavior depends on a few options, including @samp{-nc}. In certaincases, the local file will be @dfn{clobbered}, or overwritten, uponrepeated download. In other cases it will be preserved.When running Wget without @samp{-N}, @samp{-nc}, @samp{-r}, or @samp{p},downloading the same file in the same directory will result in theoriginal copy of @var{file} being preserved and the second copy beingnamed @samp{@var{file}.1}. If that file is downloaded yet again, thethird copy will be named @samp{@var{file}.2}, and so on. When@samp{-nc} is specified, this behavior is suppressed, and Wget willrefuse to download newer copies of @samp{@var{file}}. Therefore,``@code{no-clobber}'' is actually a misnomer in this mode---it's notclobbering that's prevented (as the numeric suffixes were alreadypreventing clobbering), but rather the multiple version saving that'sprevented.When running Wget with @samp{-r} or @samp{-p}, but without @samp{-N}or @samp{-nc}, re-downloading a file will result in the new copysimply overwriting the old. Adding @samp{-nc} will prevent thisbehavior, instead causing the original version to be preserved and anynewer copies on the server to be ignored.When running Wget with @samp{-N}, with or without @samp{-r} or@samp{-p}, the decision as to whether or not to download a newer copyof a file depends on the local and remote timestamp and size of thefile (@pxref{Time-Stamping}). @samp{-nc} may not be specified at thesame time as @samp{-N}.Note that when @samp{-nc} is specified, files with the suffixes@samp{.html} or @samp{.htm} will be loaded from the local disk andparsed as if they had been retrieved from the Web.@cindex continue retrieval@cindex incomplete downloads@cindex resume download@item -c@itemx --continueContinue getting a partially-downloaded file. This is useful when youwant to finish up a download started by a previous instance of Wget, orby another program. For instance:@examplewget -c ftp://sunsite.doc.ic.ac.uk/ls-lR.Z@end exampleIf there is a file named @file{ls-lR.Z} in the current directory, Wgetwill assume that it is the first portion of the remote file, and willask the server to continue the retrieval from an offset equal to thelength of the local file.Note that you don't need to specify this option if you just want thecurrent invocation of Wget to retry downloading a file should theconnection be lost midway through. This is the default behavior.@samp{-c} only affects resumption of downloads started @emph{prior} tothis invocation of Wget, and whose local files are still sitting around.Without @samp{-c}, the previous example would just download the remotefile to @file{ls-lR.Z.1}, leaving the truncated @file{ls-lR.Z} filealone.Beginning with Wget 1.7, if you use @samp{-c} on a non-empty file, andit turns out that the server does not support continued downloading,Wget will refuse to start the download from scratch, which wouldeffectively ruin existing contents. If you really want the download tostart from scratch, remove the file.Also beginning with Wget 1.7, if you use @samp{-c} on a file which is ofequal size as the one on the server, Wget will refuse to download thefile and print an explanatory message. The same happens when the fileis smaller on the server than locally (presumably because it was changedon the server since your last download attempt)---because ``continuing''is not meaningful, no download occurs.On the other side of the coin, while using @samp{-c}, any file that'sbigger on the server than locally will be considered an incompletedownload and only @code{(length(remote) - length(local))} bytes will bedownloaded and tacked onto the end of the local file. This behavior canbe desirable in certain cases---for instance, you can use @samp{wget -c}to download just the new portion that's been appended to a datacollection or log file.However, if the file is bigger on the server because it's been@emph{changed}, as opposed to just @emph{appended} to, you'll end upwith a garbled file. Wget has no way of verifying that the local fileis really a valid prefix of the remote file. You need to be especiallycareful of this when using @samp{-c} in conjunction with @samp{-r},since every file will be considered as an "incomplete download" candidate.Another instance where you'll get a garbled file if you try to use@samp{-c} is if you have a lame @sc{http} proxy that inserts a``transfer interrupted'' string into the local file. In the future a
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -