We all know that software progress bars have to be taken with a large helping of salt. It's not at all unusual for the bar to have no discernible relationship to reality, and this is particularly apt to be true for operating system installations and software startups. If any percentage indication is shown, it probably cannot be correlated to required time. The percentage is likely to hang in the same place for frustratingly long periods of time or suddenly jump large increments for no apparent reason. Part of this is because for complex tasks, it can be very difficult to estimate completion time, and part of it is surely just programmer laziness.
Your Mac OS X shell scripts can have progress bars. You might use Platypus for that (it's an application wrapper). The iHook tool is similar, but gives more control over progress bars (and everything else it knows about). AppleScript Studio also has the ability to draw and control a progress bar. There are plain AppleScript progress bars also. A very simple program that does nothing but a progress bar for scripts is ShellBar.
Of course you can just do the dot thing:
#!/bin/bash for i in *.dat do printf "." cp $i /somewhere done
Mac OS X displays a "Starting MAC OS X" graphic with a lovely blue progress bar that crawls along quite convincingly. In fact, though, it's totally fake. A program called "WaitingForLoginWindow" draws that display, but it isn't really measuring anything - it's just a bar to keep you happy while OS X starts. Well, that's not entirely true. Actually, it's drawing a bar that is calculated to last approximately the same length of time it ran on the last startup. What happens is that the Login Window process kills off this bar display when it is ready to let you log in. The bar stores how long it ran in /var/db/loginwindow.boottime and then goes away. Next time it runs, it uses that stored value to decide how quickly to move the bar. Cute, isn't it?
Well, apparently there is reason and precedence for this deception. The Placebo Mini-Pattern explains why this is useful and generally a good idea.
Got something to add? Send me email.
More Articles by Tony Lawrence © 2011-07-07 Tony Lawrence
I wanted to learn how to swim, so Google showed me how to turn on the water at the sink and let me splash it around a bit. They then dragged me into a helicopter, flew way out into the ocean and dumped me out. (Tony Lawrence)