I love GNU’s wget. I use it every day.
First, some background. Elder revisions of wget would only display dots as you download larger files. This provided hours, well, at least seconds of amusement. Newer revisions have various user-configurable bits to set the type of status bar.
I miss those dots. So here, I’ve recreated them in bourne – Just for you, gentle reader! This only simulates this older wget – displaying line after line of pretty dots. Immensely worthwhile, I’m sure you agree!
I would like to add a random ‘sleep’ function, but there’s no trivial way to do that in native bourne without assuming too much about the user’s system – since many do not have an external ‘usleep’ function. This assumes you have a bourne compatible shell, ‘printf’, ‘expr’ and ‘test’.
#!/bin/sh- Silly wget-style dot simulator in bourne compatible syntax
- By Shawn Holwegner
– No warranty, of course. This is silly! - Requires ‘printf’ helper, and a ‘sleep’ implementation that takes fractions. Bourne compatible shell that supports $RANDOM – most systems SHOULD have this KBytes=0; while [ 1 ]; do printf $KBytes”K\t -> ” SetofDots=0 while [ $SetofDots -lt 5 ]; do SetofDots=`expr $SetofDots + 1` DotIndex=0 while [ $DotIndex -lt 10 ]; do DotIndex=`expr $DotIndex + 1` # XXX – Fixme: Better usleep helper? sleep .$(($RANDOM % 1024)) 2>&1 >> /dev/null echo -n ”.” done echo -n ” ” done echo ” ” KBytes=`expr $KBytes + 50` done