wget read input from standard input

坚强是说给别人听的谎言 提交于 2019-12-10 19:57:47

问题


From the wget man page

§ 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.

I tried doing

wget -i - www.google.com

It downloaded a file index.html, but then it hangs. Even after I pressed "Enter" several times, it still hangs. Why?


回答1:


Because you have not closed your 'file' wget continues waiting for you to type more into stdin. To terminate, press ctrl + d [EOF terminator]



来源:https://stackoverflow.com/questions/13478857/wget-read-input-from-standard-input

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!