curl progress - only show percentage

家住魔仙堡 提交于 2020-06-24 04:42:05

问题


Is there an option for the curl command to show only a percentage output to shell rather than all of this, for example:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 12.4M  100 12.4M    0     0  4489k      0  0:00:02  0:00:02 --:--:-- 4653k

Maybe there is a flag I can set? If not, pipe it somehow through a regular expression to show me a continuous update of the percentage only?

Thanks all


回答1:


Two modifiers might help, although neither are exact: --silent will suppress all updates and --progress-bar will show a progress bar only.

Edit: One option to make things easier would be to make a wrapper using Expect to simplify the output to your shell script or whatever is listening to curl.




回答2:


Does the parameter -# solve your problem?

-#/--progress-bar

Make curl display progress information as a progress bar instead of the default statistics.

From here.




回答3:


You might want to try the -# option.

It shows a simple progress bar and percentage downloaded.



来源:https://stackoverflow.com/questions/1132185/curl-progress-only-show-percentage

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