Anchor(faq44)

How do I create a progress bar?

The easiest way is to use dialog --gauge. Here is an example, which relies heavily on BASH features:

   # Bash
   # Process all of the *.zip files in the current directory.
   files=(*.zip)
   dialog --gauge "Working..." 20 75 < <(
      n=${#files[*]}; i=0
      for f in "${files[@]}"; do
         # process "$f" in some way (for testing, "sleep 1")
         echo $((100*(++i)/n))
      done)

Here's an explanation of what it's doing:

For more examples of using dialog, see [:BashFAQ/040:FAQ #40].