LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Using dialog --gauge to display download percentage from wget (https://www.linuxquestions.org/questions/programming-9/using-dialog-gauge-to-display-download-percentage-from-wget-474280/)

mentallysilent 08-16-2006 12:21 AM

Using dialog --gauge to display download percentage from wget
 
Hello to you masters,

I'm writing a bash script that will download and install the Eiffel language on linux, and for this I'm using the dialog utility. I use wget to download the .tgz file from a mirror but instead of wget printing to stdout I'd like 'dialog' to show the progress nicely using the --gauge option. As of now I can get the progress bar to move with something like this:

Code:

#!/bin/bash

i=0

while [ $i -le 100 ]
do
  echo $i | dialog --gauge "download progress" 10 30
  i=`expr $i + 1`
  sleep 1
done

but this is not dynamic as you can see...I was trying to grep for wget's output and then pipe that to dialog but nothing seems to work...your help is greatly appreciated.

unSpawn 08-16-2006 07:35 PM

Something like
Code:

#!/bin/sh
logfile=$TEMP/logfile; [ -f "$logfile" ] && rm -f "$logfile"
wget -v -b proto://addr.ess/file -o "$logfile"
grep "[0-9]\{1,2\}%" "$logfile"|awk '{print $7}'|while read n; do
 echo ${n%%%} | dialog --gauge "amount of warez deleted" 10 30; done
exit 0


mentallysilent 08-17-2006 02:55 AM

Thank alot.


All times are GMT -5. The time now is 05:31 PM.