Monthly Archive for October, 2007

zenity progress example script (Gnome/X)

screenshot-exampleprogress.png

I like to see the percentage done of an ongoing process. I also want to make it easier for others to do the same, so I created a small example-script for how to do it from a bash script. On the left side, you see how it will look like.

I have seen some scripts using awk to calculate the percentage of a progress when the output is to verbose maybe doesn’t show the percentage but a number of a total.

You can also add –auto-kill if you want the cancel-button to kill the parent pid.

Enjoy making X graphical verbose scripts!

zenity-progress-example.sh

(for a in `seq 1 100` ;
do
echo $a;
sleep 0.03;
done) | zenity --auto-close --progress \
--text="Slow counting from 1 to 100" \
--title="Example Progress"