wget从标准输入读取输入

时间:2012-11-20 17:36:32

标签: wget stdin

来自wget手册页

§ 2.4 Logging and Input File Options

‘-i file’
‘--input-file=file’
     Read urls from a local or external file. If ‘-’ is specified as file, urls
     are read from the standard input. (Use ‘./-’ to read from a file literally
     named ‘-’.)

     If this function is used, no urls need be present on the command line. If
     there are urls both on the command line and in an input file, those on the
     command lines will be the first ones to be retrieved. If ‘--force-html’ is
     not specified, then file should consist of a series of URLs, one per line.

我试过

wget -i - www.google.com

它下载了一个文件index.html,但随后它就会挂起。甚至在我按下之后 多次“输入”,它仍然挂起。为什么呢?

1 个答案:

答案 0 :(得分:4)

因为你还没有关闭你的'文件'wget继续等待你输入更多的stdin。要终止,请按ctrl + d [EOF终止符]