This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
The community reviewed whether to reopen this question 8 months ago and left it closed:
Original close reason(s) were not resolved
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(9)
使用:
-q
:关闭wget
的输出--show-progress
:强制wget
显示进度条,无论其详细级别设置为多少Use:
-q
: Turn offwget
's output--show-progress
: Forcewget
to display the progress bar no matter what its verbosity level is set to使用这些标志运行:
Run using these flags:
您可以使用以下过滤器:
用法:
此函数取决于在进度条启动之前发送的
0x0d0x0a0x0d0x0a0x0d
序列。此行为可能依赖于实现。You can use the following filter:
Usage:
This function depends on a sequence of
0x0d0x0a0x0d0x0a0x0d
being sent right before the progress bar is started. This behavior may be implementation dependent.可以使用
tail
的follow
选项:+6
是删除前6行。根据您的wget
版本或您的语言,它可能会有所不同。您需要使用
--progress=bar:force
否则 wget 会切换到dot
类型。缺点是刷新频率比 wget 低(看起来每 2 秒刷新一次)。
tail
的--sleep-interval
选项似乎就是为了这个目的,但它对我来说没有任何改变。You can use the
follow
option oftail
:The
+6
is to delete the first 6 lines. It may be different on your version ofwget
or your language.You need to use
--progress=bar:force
otherwise wget switches to thedot
type.The downside is that the refreshing is less frequent than with wget (looks like every 2 seconds). The
--sleep-interval
option oftail
seems to be meant just for that, but it didn't change anything for me.正如其他人指出的那样,选项
--show-progress
是最好的选项,但它仅从 GNU wget 1.16 开始可用,请参阅 wget 1.16 中值得注意的变化。为了安全起见,我们可以首先检查是否支持
--show-progress
:也许是时候考虑只使用
curl
了。The option
--show-progress
, as pointed out by others, is the best option, but it is available only since GNU wget 1.16, see Noteworthy changes in wget 1.16.To be safe, we can first check if
--show-progress
is supported:Maybe it's time to consider just using
curl
.您可以使用标准选项:
You can use standard options:
这是另一个例子:
This is another example:
这是一个解决方案,它将为每个文件(或行,就此而言)显示一个点。如果您使用
--recursive
下载,它特别有用。这不会捕获错误,如果有额外的行,可能会略有偏差,但对于许多文件的总体进展来说,它是有帮助的:Here is a solution that will show you a dot for each file (or line, for that matter). It is particularly useful if you are downloading with
--recursive
. This won't catch errors and may be slightly off if there are extra lines, but for general progress on a lot of files it is helpful:这并不是字面上的答案,但此代码片段可能对一些来这里的人有帮助,例如“zenity wget GUI”:
LANG=C wget -O /dev/null --progress=bar:force:noscroll --limit -速率 5k http://nightly.altlinux.org/sisyphus/ChangeLog 2>&1 | stdbuf -i0 -o0 -e0 tr '>' '\n' | stdbuf -i0 -o0 -e0 sed -rn 's/^.*\<([0-9]+)%\[.*$/\1/p'| zenity --progress --auto-close
对我来说至关重要的是
stdbuf(1)
。This is not literally an answer but this snippet might also be helpful to some coming here for e.g. "zenity wget GUI":
LANG=C wget -O /dev/null --progress=bar:force:noscroll --limit-rate 5k http://nightly.altlinux.org/sisyphus/ChangeLog 2>&1 | stdbuf -i0 -o0 -e0 tr '>' '\n' | stdbuf -i0 -o0 -e0 sed -rn 's/^.*\<([0-9]+)%\[.*$/\1/p' | zenity --progress --auto-close
What was crucial for me is
stdbuf(1)
.