如何让 cURL 不显示进度条? [英] How do I get cURL to not show the progress bar?
问题描述
我正在尝试在脚本中使用 cURL 并让它不显示进度条.
I'm trying to use cURL in a script and get it to not show the progress bar.
我尝试了 -s
、-silent
、-S
和 -quiet
选项,但它们都不起作用.
I've tried the -s
, -silent
, -S
, and -quiet
options, but none of them work.
这是我尝试过的典型命令:
Here's a typical command I've tried:
curl -s http://google.com > temp.html
我只在将其推送到文件时获得进度条,所以 curl -s http://google.com
没有进度条,但 curl -s http://google.com >temp.html
可以.
I only get the progress bar when pushing it to a file, so curl -s http://google.com
doesn't have a progress bar, but curl -s http://google.com > temp.html
does.
推荐答案
curl -s http://google.com > temp.html
适用于 Ubuntu 9.10 上的 curl 7.19.5 版(无进度条).但是,如果由于某种原因在您的平台上不起作用,您始终可以将 stderr 重定向到/dev/null:
works for curl version 7.19.5 on Ubuntu 9.10 (no progress bar). But if for some reason that does not work on your platform, you could always redirect stderr to /dev/null:
curl http://google.com 2>/dev/null > temp.html
这篇关于如何让 cURL 不显示进度条?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!