I'm currently using the --gauge option of dialog to increment a progress bar as a few tasks are completed eg:
(
echo 20; echo "XXX"; echo "Task 1"; echo "XXX" ; #Task 1 here
sleep 2 ;
echo 40; echo "XXX"; echo "Task 2"; echo "XXX" ; #Task 2 here
sleep 2 ;
echo 60; echo "XXX"; echo "Task 3"; echo "XXX" ; #Task 3 here
sleep 2 ;
echo 80; echo "XXX"; echo "Task 4"; echo "XXX" ; #Task 4 here
sleep 2 ;
echo 100; echo "XXX"; echo "Task 5"; echo "XXX" ; #Task 5 here
) | dialog --gauge "Performing Tasks" 6 50
What I also would like to do is use --gauge to show progress of a command that starts an install (sudo ./retropie_packages.sh pegasus-fe).
It seems that as I don't have individual tasks like in the above that approach will not work. I've seen pv suggested for such a thing but cannot figure out how to pipe my task through it.
Any ideas/suggestions welcome.
Probably not the correct way to do it but I ended up doing this:
test=0
sudo ./retropie_packages.sh pegasus-fe |
while IFS= read i; do
((++stepscomplete))
percentcomplete=$((stepscomplete*3))
if [ $percentcomplete-lt 100 ]
then
echo $percentcomplete| dialog --hline " TEXT " --backtitle "TESTING..." --gauge "Installing Pegasus" 6 50
else
echo 100 | dialog --hline " TEXT " --backtitle "TESTING..." --gauge "Installing Pegasus" 6 50
fi
done
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments