Wget

wget -O 是什麼意思 -

  • October 30, 2019

我正在嘗試將 dropbox 安裝到我的 Debian 機器上,我看到了說明

cd ~ && wget -O - "some website leading to the download of a tar file" | tar xzf - 

但我所做的只是輸入以下內容:

wget -O - "some website leading to the download of a tar file"

我的終端上有很多垃圾。是什麼 wget -O -意思?它對我的電腦有任何傷害嗎?

看一下手冊頁wget

-O file
  --output-document=file
      The documents will not be written to the appropriate files, but all
      will be concatenated together and written to file.  If - is used as
      file, documents will be printed to standard output, disabling link
      conversion.  (Use ./- to print to a file literally named -.)

      Use of -O is not intended to mean simply "use the name file instead
      of the one in the URL;" rather, it is analogous to shell redirection:
      wget -O file http://foo is intended to work like 
      wget -O - http://foo > file; file will be truncated immediately, and
      all downloaded content will be written there.

因此,您可以使用將“URL”的內容下載到文件中-O somefile,也可以下載它並通過 STDOUT 將其內容重定向到另一個工具以對其進行處理。在這種情況下,這就是他們對| tar xvf -.

你的命令:

$ cd ~ && wget -O - "some website leading to the download of a tar file" | tar xzf -

以上是從“URL”獲取壓縮包,並且在下載它時,它被重定向到命令tar,以便可以將其解壓縮到您的文件系統中。

引用自:https://unix.stackexchange.com/questions/83829