The Cookie Machine - Click here to drag window

DUMMY TEXT - Real text set in assets/js/theCookieMachine.js

Views: 2,865β€…    Votes:  3β€…
Tags: command-line   yad  
Link: πŸ” See Original Answer on Ask Ubuntu πŸ”—

Title: How do I create a fake process bar?
ID: /2018/04/23/How-do-I-create-a-fake-process-bar_
Created: April 23, 2018    Edited:  June 12, 2020
Upload: November 24, 2022    Layout:  post
TOC: false    Navigation:  false    Copy to clipboard:  false

Fake Progress Bar

This progress bar uses real data in /bin directory which everyone has. The script can be β€œdumbed down” to suit your fake needs. Or it can be expanded for a real life application:


It uses yad which is a super-charged version of zenity the default GUI used in the terminal. To install yad use:

sudo apt install yad

Here’s the code:


# NAME: yad-progress-bar
# PATH: /mnt/e/bin
# DESC: Display yad progress bar % with names.
# DATE: Apr 23, 2018.  Modified Oct 18, 2019.

Title="Processing files for: $Source"
AllFiles=$(ls $Source/* | wc -l)

for f in "$Source"/* ; do

    echo "#$f"              # Display file name in progress bar.
    Count=$(( $Count + 1 ))
    Percent=$(( Count * 100 / AllFiles ))
    echo $Percent           # Display percent complete in progress bar.
    sleep .025

done | yad --progress       --auto-close \
    --width=500             --height=300 \
    --title="$Title"        --enable-log "Current filename" \
    --log-expanded          --log-height=250 \
    --log-on-top            --percentage=0 \
    --no-cancel             --center
⇧ Is there a command to get the number of frames in a gif? Another (unsolvable) "old glib" problem  β‡©