Fla*_*ani 64 linux bash wget sh
例如:
wget http://somesite.com/TheFile.jpeg
downloading: TheFile.tar.gz ...
--09:30:42-- http://somesite.com/TheFile.jpeg
=> `/home/me/Downloads/TheFile.jpeg'
Resolving somesite.co... xxx.xxx.xxx.xxx.
Connecting to somesite.co|xxx.xxx.xxx.xxx|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1,614,820 (1.5M) [image/jpeg]
25% [======> ] 614,424 173.62K/s ETA 00:14
Run Code Online (Sandbox Code Playgroud)
我怎么能让它看起来像这样
downloading: TheFile.jpeg ...
25% [======> ] 614,424 173.62K/s ETA 00:14
Run Code Online (Sandbox Code Playgroud)
我知道curl可以做到这一点,但是我需要得到wget才能做到这一点.
Lor*_* Bo 136
使用:
wget http://somesite.com/TheFile.jpeg -q --show-progress
Run Code Online (Sandbox Code Playgroud)
-q - 关闭Wget的输出
--show-progress - 强制wget以任何详细程度显示进度条
Pau*_*ce. 24
您可以使用以下过滤器:
progressfilt ()
{
local flag=false c count cr=$'\r' nl=$'\n'
while IFS='' read -d '' -rn 1 c
do
if $flag
then
printf '%s' "$c"
else
if [[ $c != $cr && $c != $nl ]]
then
count=0
else
((count++))
if ((count > 1))
then
flag=true
fi
fi
fi
done
}
Run Code Online (Sandbox Code Playgroud)
$ wget --progress=bar:force http://somesite.com/TheFile.jpeg 2>&1 | progressfilt
100%[======================================>] 15,790 48.8K/s in 0.3s
2011-01-13 22:09:59 (48.8 KB/s) - 'TheFile.jpeg' saved [15790/15790]
Run Code Online (Sandbox Code Playgroud)
此功能取决于在0x0d0x0a0x0d0x0a0x0d进度条启动之前发送的顺序.此行为可能取决于实现.
小智 12
使用以下标志来使用:
wget -q --show-progress --progress=bar:force 2>&1
Run Code Online (Sandbox Code Playgroud)
rye*_*nus 11
该选件--show-progress,如被别人指出的那样,是最好的选择,但它仅适用,因为GNU wget的1.16,看在1.16的wget值得注意的变化.
为安全起见,我们可以先检查是否--show-progress支持:
# set progress option accordingly
wget --help | grep -q '\--show-progress' && \
_PROGRESS_OPT="-q --show-progress" || _PROGRESS_OPT=""
wget $_PROGRESS_OPT ...
Run Code Online (Sandbox Code Playgroud)
也许是时候考虑使用了curl.
Met*_*xal 10
您可以使用以下follow选项tail:
wget somesite.com/TheFile.jpeg --progress=bar:force 2>&1 | tail -f -n +6
Run Code Online (Sandbox Code Playgroud)
的+6是删除第6行.您的版本wget或语言可能有所不同.
您需要使用--progress=bar:force其他wget开关到该dot类型.
缺点是刷新的频率低于wget(看起来每2秒).该--sleep-interval的选项tail似乎只是将要的意思,但它并没有为我改变什么.