如何使旋度不显示进度条?

时间:2021-03-27 00:28:40

I'm trying to use cURL in a script and get it to not show the progress bar.

我试图在脚本中使用cURL,使它不显示进度条。

I've tried the -s, -silent, -S, and -quiet options, but none of them work.

我尝试过-s, -silent, -s和-quiet选项,但它们都不起作用。

Here's a typical command I've tried:

我试过的一个典型的命令是:

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没有进度条,但是curl -s http://google.com > temp.html有进度条。

4 个解决方案

#1


376  

curl -s http://google.com > temp.html

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 7.19.5版本的Ubuntu 9.10(没有进度条)。但是,如果由于某些原因不能在您的平台上工作,您可以始终将stderr重定向到/dev/null:

curl  http://google.com 2>/dev/null > temp.html

#2


363  

In curl version 7.22.0 on Ubuntu and 7.24.0 on OSX the solution to not show progress but to show errors is to use both -s (--silent) and -S (--show-error) like so:

在curl版本7.22.0的Ubuntu和7.24.0的OSX中,不显示进度而显示错误的解决方案是同时使用-s (--silent)和-s (- show-error),如下所示:

curl -sS http://google.com > temp.html

This works for both redirected output > /some/file, piped output | less and outputting directly to the terminal for me.

这适用于重定向输出> /some/file,管道输出|更少,直接输出到终端。

#3


34  

I found that with curl 7.18.2 the download progress bar is not hidden with:

我发现curl 7.18.2下载进度条没有隐藏:

curl -s http://google.com > temp.html

but it is with:

但它是:

curl -ss http://google.com > temp.html

#4


6  

Not sure why it's doing that. Try -s with the -o option to set the output file instead of >.

不知道为什么会这样。尝试使用-o选项-s设置输出文件,而不是>。

#1


376  

curl -s http://google.com > temp.html

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 7.19.5版本的Ubuntu 9.10(没有进度条)。但是,如果由于某些原因不能在您的平台上工作,您可以始终将stderr重定向到/dev/null:

curl  http://google.com 2>/dev/null > temp.html

#2


363  

In curl version 7.22.0 on Ubuntu and 7.24.0 on OSX the solution to not show progress but to show errors is to use both -s (--silent) and -S (--show-error) like so:

在curl版本7.22.0的Ubuntu和7.24.0的OSX中,不显示进度而显示错误的解决方案是同时使用-s (--silent)和-s (- show-error),如下所示:

curl -sS http://google.com > temp.html

This works for both redirected output > /some/file, piped output | less and outputting directly to the terminal for me.

这适用于重定向输出> /some/file,管道输出|更少,直接输出到终端。

#3


34  

I found that with curl 7.18.2 the download progress bar is not hidden with:

我发现curl 7.18.2下载进度条没有隐藏:

curl -s http://google.com > temp.html

but it is with:

但它是:

curl -ss http://google.com > temp.html

#4


6  

Not sure why it's doing that. Try -s with the -o option to set the output file instead of >.

不知道为什么会这样。尝试使用-o选项-s设置输出文件,而不是>。