Xdialog example - progress bar

interpretive language scripts


Moderator: Forum moderators

Post Reply
don570
Posts: 688
Joined: Sat Nov 21, 2020 4:43 pm
Has thanked: 5 times
Been thanked: 117 times

Xdialog example - progress bar

Post by don570 »

Here is an example to show a progress bar .
One drawback is that the time must be known first.
This is the variable TIME_ESTIMATE.
(Note that TIME_ESTIMATE must be 10 or greater)
It is divided by 10 to show the progress.

Note: <text> enclosed by two "XXX" markers
A newline can be inserted into the new <text> by issuing: ----> Xdialog must actually receive a string holding the two "\" and "n" characters, and not just a line feed.

Documentation:
http://xdialog.free.fr/doc/box.html#GAUGE

Better scripts using 'progress widget'
http://xdialog.free.fr/doc/samples/allrpms
http://xdialog.free.fr/doc/samples/format1440

Code: Select all

#!/bin/bash
TIME_ESTIMATE=30
TIME=$(($TIME_ESTIMATE/10))
(echo "10" ; sleep $TIME

echo "XXX"
echo "Progess"
echo "\\n"
echo "message"
echo "XXX"
echo "20" ; sleep $TIME
echo "30" ; sleep $TIME
echo "40" ; sleep $TIME
echo "50" ; sleep $TIME
echo "60" ; sleep $TIME
echo "70" ; sleep $TIME
echo "80" ; sleep $TIME
echo "90" ; sleep $TIME
echo "100" ; sleep $TIME) |

Xdialog --title "Compress" --gauge "Hi, this is a gauge widget" 10 40

if [ "$?" = 255 ] ; then
	echo ""
	echo "Box closed !"
fi
User avatar
glene77is
Posts: 62
Joined: Thu Aug 13, 2020 7:44 pm
Location: Univ of TN, Memphis,TN,USA
Has thanked: 49 times
Been thanked: 7 times
Contact:

Re: Xdialog example - progress bar

Post by glene77is »

to Don570
Interesting program.
Done without overloading Bash.

*Just an old Apprentice caught Tinkering in the Master's WorkShop. *
Glen Ellis ( ͡° ͜ʖ ͡° ) K4KKQ , Electronic Engineering :ugeek:
Website: http://www.GeoCities.WS/glene77is :thumbup2:
Electrical Science , Memphis, TN

Post Reply

Return to “Scripts”