You are not logged in.

#1 2006-08-16 06:06:41

mentallysilent
Member
Registered: 2006-08-10
Posts: 18

Using dialog --gauge to display download percentage from wge

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:

#!/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.

Offline

#2 2006-08-16 06:37:15

dojo
Member
Registered: 2005-11-02
Posts: 97

Re: Using dialog --gauge to display download percentage from wge

Hi,

i can't provide a complete solution but some hints. Write the output of wget in a temporary file

wget -o $tmpfile url

. Read the last two lines

tail -n 2 $tmpfile

and then extract the current persentage with regular expression.

Greets

dojo

Offline

#3 2006-08-16 11:07:42

mentallysilent
Member
Registered: 2006-08-10
Posts: 18

Re: Using dialog --gauge to display download percentage from wge

thanks for the reply....one question tho...do I need to exec wget in a subshell?...since I need some mechanism of piping that percent value to dialog --guage from wget...how would you go about doing this? thanks a bunch.

Offline

#4 2006-08-16 18:12:31

dojo
Member
Registered: 2005-11-02
Posts: 97

Re: Using dialog --gauge to display download percentage from wge

Subshell could be a solution. Or just background it. 100 percent implies that wget has finished successfull.

Greets

dojo

Offline

Board footer

Powered by FluxBB