The progress meter box (gauge)

The progress meter displays a meter at the bottom of the box. This meter indicates the percentage of the process completed. New percentages are read from standard input, one integer per line. This meter is updated to reflect each new percentage.

Let's write the dialog_05.sh shell script to create a progress meter as follows:

#!/bin/bash 
declare -i COUNTER=1 
{ 
    while test $COUNTER -le 100 
        do 
            echo $COUNTER 
            COUNTER=COUNTER+1 
            sleep 1 
    done 
    } |  dialog --gauge  "This is a progress bar"  10 50 0 

Let's test the following program:

    $ chmod +x dialog_05.sh
    $ ./dialog_05.sh
  

Output:

Customization of dialog with the configuration ...

Get Learning Linux Shell Scripting - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.