Page 1 of 1

Xdialog example - progress bar

Posted: Sat Feb 04, 2023 6:37 pm
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

Re: Xdialog example - progress bar

Posted: Wed Feb 08, 2023 12:06 pm
by glene77is

to Don570
Interesting program.
Done without overloading Bash.