How can I show the wget progress bar only? [closed]
Solution 1:
Use:
wget http://somesite.com/TheFile.jpeg -q --show-progress
-q
: Turn offwget
's output--show-progress
: Forcewget
to display the progress bar no matter what its verbosity level is set to
Solution 2:
You can use the following filter:
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
}
Usage:
$ 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]
This function depends on a sequence of 0x0d0x0a0x0d0x0a0x0d
being sent right before the progress bar is started. This behavior may be implementation dependent.