What does “wget -O” mean?

后端 未结 4 1575
长情又很酷
长情又很酷 2020-12-23 13:51

I have an wget command like this in my shell script:

reponse=\"`wget -O- http:localhost:8080/app/index.html`\"

I don\'t understand the -O-

4条回答
  •  旧时难觅i
    2020-12-23 14:41

    Depending on your system you should be able to find reference by typing man wget. The GNU Wget man page says this of the -O|--output-document flag:

    If - is used as file, documents will be printed to standard output, disabling link conversion. (Use ./- to print to a file literally named -.)

    And continues…

    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.

    It's not uncommon to see combined with -q and written as -q0- or -q0 - followed by a uri. It validates against the POSIX standard so, yeah, I'd say it's a standard thing for shell scripting.

提交回复
热议问题