Tuesday, February 27, 2007

Fake Progress Bar in shell


Just to illustrate the use of "until" loop in BASH, here is a small script to generate a fake progress bar.

#!/bin/sh
clear
echo "Installation in Progress" [`basename $0`]
count=0
until [ $count -eq 10 ]
do
echo -n "###"
sleep 1
count=`expr $count + 1`
done
echo -n "[100%]"
echo

$ ./fakeprogress.sh
Installation in Progress [fakeprogress.sh]
##############################[100%]

1 comment:

hamen said...

Fake, but effective!
Thanks

© Jadu Saikia www.UNIXCL.com