在Linux中隐藏wget输出

Ash*_*yan 37 linux bash wget

我不想在使用时看到任何消息wget.

我尝试wget-q -O选项和重定向,/dev/null但我仍然看到不需要的消息.

编辑 对不起大家,我的脚本中有另一个wget打印消息:) &> /dev/null对我来说已经足够了.

fed*_*qui 74

你为什么不用-q

来自man wget:

-q
--quiet
   Turn off Wget's output.
Run Code Online (Sandbox Code Playgroud)

测试

$ wget www.google.com
--2015-05-08 14:07:42--  http://www.google.com/
Resolving www.google.com (www.google.com)... 
  (...)
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘index.html’

    [ <=>                                                                                       ] 17,913      --.-K/s   in 0.01s   

2015-05-08 14:07:42 (1.37 MB/s) - ‘index.html’ saved [17913]
Run Code Online (Sandbox Code Playgroud)

和:

$ wget -q www.google.com
$
Run Code Online (Sandbox Code Playgroud)

  • `我尝试使用-q -O选项重定向到/ dev/null wget但我仍然看到不需要的消息 (4认同)