コマンドライン引数でWgetのデフォルト設定を変更する方法を知ると,これら の設定を永久的に行いたいと思うかもしれません.Wgetスタートアップファイ ル--- `.wgetrc'---を作成するという便利な方法でそうすることが可能 です.
さらに,`.wgetrc'は"主な"初期化ファイルとなっていて,強固なパス ワードに対する特別な能力があるので便利です.このためWgetは, `$HOME/.netrc'がある場合は,その内容を読み込み解釈します. `.netrc'書式はシステムのマニュアルで見つかります.
Wgetは,限定されたコマンド群を認識し,スタートアップ時に`.wgetrc' を読みます.
初期化時,Wgetはデフォルトで`/usr/local/etc/wgetrc'(または,Wget がそこにインストールされていない場合,`/usr/local'ではない接頭辞) にあるglobalなスタートアップファイルを探し,存在する場合はそれか らコマンドを読み込みます.
それから,ユーザファイルを探します.環境変数WGETRC
が設定されて
いる場合,そのファイルをロードしようとします.失敗した場合,それ以上何
もしません.
WGETRC
が設定されていない場合,Wgetは`$HOME/.wgetrc'をロー
ドしようとします.
ユーザ設定がシステム全体のものの後にロードされるということは,ユーザの wgetrcと衝突した場合,システム全体のwgetrc(デフォルトで `/usr/local/etc/wgetrc')に優先するということを意味します. 全体主義の管理者は不在です!
wgetrcコマンドの構文は単純です.
variable = value
変数(variable)はコマンド(command)とも呼ばれます.有効な 値(value)はコマンドによって異なります.
コマンドは大文字小文字とアンダースコアを識別しません.このため, `DIr__PrefiX'は`dirprefix'と同じです.`#'で始まる行と空 白のみ含む行は,空行として捨てられます.
カンマで分けられたリストを期待するコマンドは,空のコマンドでリストをク リアします.そのため,全体的な`wgetrc'で指定された拒絶するリスト をリセットしたい場合,以下のようにして行うことができます.
reject =
コマンドの完全な組合わせは,以下にリストアップされています.正当な値は, `='以下にリストアップされています.単純な真偽値は,`on'と `off',または`1'と`0'で,設定または解除ができます.場合 によっては利用可能な,変った種類の真偽値はlockable Booleanで,そ れは,`on',`off',`always',または`never'に設定可 能です.オプションが`always'や`never'に設定されている場合, Wgetの呼び出しの間中,値は固定されます---コマンドラインオプションは優 先されません.
コマンドには,擬似的に任意の値をとるものもあります.address値は ホスト名やドットで分けられたIPアドレスが可能です.nはあらゆる正 の整数や,該当する場合は無限に対する`inf'が利用可能です. string値は,空ではないあらゆる文字列が可能です.
これらのほとんどのコマンドは,コマンドラインと同じですが (see section 呼び出し),時代遅れのものや滅多に使用されないものもあります.
Content-Length
ヘッダを無視します.
`--ignore-length'と同じです.
Content-Length
の値より大きいまたは同じであると規定
されます.
以下は,配布物で与えられる初期化ファイルの例です.それは二つの部分に分 けられます---一つは全体的な使用で(全体的なスタートアップファイルに適し ています),もう一つはローカルで使用するもの(`$HOME/.wgetrc'に適し ています)です.変更には注意してください.
ほとんど全ての行がコメントアウトされていることに注意してください.効果 を得たいあらゆる行に対し,行の前に前置された`#'を削除する必要があ ります.
### ### Sample Wget initialization file .wgetrc ### ## You can use this file to change the default behaviour of wget or to ## avoid having to type many many command-line options. This file does ## not contain a comprehensive list of commands -- look at the manual ## to find out what you can put into this file. ## ## Wget initialization file can reside in /usr/local/etc/wgetrc ## (global, for all users) or $HOME/.wgetrc (for a single user). ## ## To use the settings in this file, you will have to uncomment them, ## as well as change them, in most cases, as the values on the ## commented-out lines are the default values (e.g. "off"). ## ## Global settings (useful for setting up in /usr/local/etc/wgetrc). ## Think well before you change them, since they may reduce wget's ## functionality, and make it behave contrary to the documentation: ## # You can set retrieve quota for beginners by specifying a value # optionally followed by 'K' (kilobytes) or 'M' (megabytes). The # default quota is unlimited. #quota = inf # You can lower (or raise) the default number of retries when # downloading a file (default is 20). #tries = 20 # Lowering the maximum depth of the recursive retrieval is handy to # prevent newbies from going too "deep" when they unwittingly start # the recursive retrieval. The default is 5. #reclevel = 5 # Many sites are behind firewalls that do not allow initiation of # connections from the outside. On these sites you have to use the # `passive' feature of FTP. If you are behind such a firewall, you # can turn this on to make Wget use passive FTP by default. #passive_ftp = off # The "wait" command below makes Wget wait between every connection. # If, instead, you want Wget to wait only between retries of failed # downloads, set waitretry to maximum number of seconds to wait (Wget # will use "linear backoff", waiting 1 second after the first failure # on a file, 2 seconds after the second failure, etc. up to this max). waitretry = 10 ## ## Local settings (for a user to set in his $HOME/.wgetrc). It is ## *highly* undesirable to put these settings in the global file, since ## they are potentially dangerous to "normal" users. ## ## Even when setting up your own ~/.wgetrc, you should know what you ## are doing before doing so. ## # Set this to on to use timestamping by default: #timestamping = off # It is a good idea to make Wget send your email address in a `From:' # header with your request (so that server administrators can contact # you in case of errors). Wget does *not* send `From:' by default. #header = From: Your Name <username@site.domain> # You can set up other headers, like Accept-Language. Accept-Language # is *not* sent by default. #header = Accept-Language: en # You can set the default proxies for Wget to use for http and ftp. # They will override the value in the environment. #http_proxy = http://proxy.yoyodyne.com:18023/ #ftp_proxy = http://proxy.yoyodyne.com:18023/ # If you do not want to use proxy at all, set this to off. #use_proxy = on # You can customize the retrieval outlook. Valid options are default, # binary, mega and micro. #dot_style = default # Setting this to off makes Wget not download /robots.txt. Be sure to # know *exactly* what /robots.txt is and how it is used before changing # the default! #robots = on # It can be useful to make Wget wait between connections. Set this to # the number of seconds you want Wget to wait. #wait = 0 # You can force creating directory structure, even if a single is being # retrieved, by setting this to on. #dirstruct = off # You can turn on recursive retrieving by default (don't do this if # you are not sure you know what it means) by setting this to on. #recursive = off # To always back up file X as X.orig before converting its links (due # to -k / --convert-links / convert_links = on having been specified), # set this variable to on: #backup_converted = off # To have Wget follow FTP links from HTML files by default, set this # to on: #follow_ftp = off
Go to the first, previous, next, last section, table of contents.