I don't know if this issue is solve but i have made a script using
zenity progress fully functional.
The script makes a backup file. The progress bar also works fine, it
shows the exact percentage of the copy and if you press the cancel
button close the zenity window and kill the copy process. I hope this
would help to someone.
Here's a copy of the code i wrote.
#!/bin/bash
fuente=~/.VirtualBox/XP.vdi
destino=~/.VirtualBox/XP.vdi.backup
size="$(ls -l ~/.VirtualBox/XP.vdi | awk '{print $5}')"
copy=0
cp $fuente $destino &
while [ $copy -lt $size ]
do
sleep 1
porcentaje="$( echo "scale = 5 ; $copy / $size * 100 " | bc )"
echo "#Copiando $copy bytes. TamaƱo total: $size bytes."
echo $porcentaje
copy="$(ls -l $destino | awk '{print $5}')"
done | zenity --progress --width=350 --title='Creando XP.vdi.backup'
if [ "$?" = 1 ] ; then
pidC="$(pidof cp)"
kill $pidC
rm -v $destino
zenity --info --width=300 height--200 --title="Borrar Backup"
--text="El proceso numero $pidC ha sido destruido.\n\nEl archivo $destino ha
sido borrado."
fi
P.D. I'm from Mexico, thats why the labels and the variable's names are
in spanish. Hope doesn't matter.
--
zenity --progress cancel button doesn't return a value
https://bugs.launchpad.net/bugs/220656
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs