ada*_*ges 518 unix linux bash scripting curl
我正在尝试在脚本中使用cURL并让它不显示进度条.
我已经试过了-s,-silent,-S,和-quiet选择,但他们没有工作.
这是我尝试过的典型命令:
curl -s http://google.com > temp.html
Run Code Online (Sandbox Code Playgroud)
我将它推送到文件时只获得进度条,因此curl -s http://google.com没有进度条,但curl -s http://google.com > temp.html确实如此.
unu*_*tbu 520
curl -s http://google.com > temp.html
Run Code Online (Sandbox Code Playgroud)
适用于Ubuntu 9.10上的curl版本7.19.5(无进度条).但是如果由于某些原因在您的平台上无效,您可以始终将stderr重定向到/ dev/null:
curl http://google.com 2>/dev/null > temp.html
Run Code Online (Sandbox Code Playgroud)
chm*_*mac 503
在Ubuntu上的curl版本7.22.0和OSX上的7.24.0上,不显示进度但显示错误的解决方案是同时使用-s(--silent)和-S(--show-error):
curl -sS http://google.com > temp.html
Run Code Online (Sandbox Code Playgroud)
这适用于重定向输出> /some/file,管道输出| less和直接输出到终端.
小智 45
我发现使用curl 7.18.2时,下载进度条不会隐藏:
curl -s http://google.com > temp.html
Run Code Online (Sandbox Code Playgroud)
但它与:
curl -ss http://google.com > temp.html
Run Code Online (Sandbox Code Playgroud)
clo*_*ejo 16
自 curl 7.67.0 (2019-11-06)以来,有--no-progress-meter,它就是这样做的,没有别的。从手册页:
Run Code Online (Sandbox Code Playgroud)--no-progress-meter Option to switch off the progress meter output without muting or otherwise affecting warning and informational messages like -s, --silent does. Note that this is the negated option name documented. You can thus use --progress-meter to enable the progress meter again. See also -v, --verbose and -s, --silent. Added in 7.67.0.
它在 Ubuntu ?20.04 和 Debian ?11 (Bullseye) 中可用。
有关 curl 详细选项的一些历史,您可以阅读Daniel Stenberg 的博客文章。
| 归档时间: |
|
| 查看次数: |
286454 次 |
| 最近记录: |