Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send values to Zenity progress bar

Tags:

I've written a simple script that uses 7zip to backup a directory. Everything works, but now I wanted to add some graphical feedback to it, adding a progress bar. I know that I can do this with zenity but, no matter what I try, I can't seem to make it work.

I am using fgrep to find out when a new file is being compressed ("Compressing" is the first word of every line printed on screen by 7zip) in order to make the bar increase. The specific line of code is the following:

7z a -t7z /home/user/Desktop/Backup.7z /home/user/Desktop/folder_to_backup -mx9 | fgrep Compressing | nl | awk '{print $1/$number_of_files*100}' | zenity --progress --percentage=0 --auto-close

Running this makes the progress bar appear, starting from 0, but no progress is shown: when the operation is complete, the bar suddenly jump to the end.

I've googled this for a while but the only thing I've found out is that zenity progress seems to have some problems :D Any help would be highly appreciated!