LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-16-2006, 12:21 AM   #1
mentallysilent
LQ Newbie
 
Registered: Apr 2004
Distribution: Arch Linux
Posts: 19

Rep: Reputation: 0
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.
 
Old 08-16-2006, 07:35 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
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

Last edited by unSpawn; 08-16-2006 at 07:42 PM. Reason: Reason? What reason? I don't need no reason!
 
Old 08-17-2006, 02:55 AM   #3
mentallysilent
LQ Newbie
 
Registered: Apr 2004
Distribution: Arch Linux
Posts: 19

Original Poster
Rep: Reputation: 0
Thank alot.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with dialog(Xdialog) --gauge option zackarya Programming 7 09-02-2010 03:25 AM
large download with wget -c michapma Linux - Software 4 07-20-2006 05:12 AM
WGET: How do I cancel a download? PionexUser Linux - Software 3 12-06-2005 12:30 PM
Dialog GAUGE - How to display progress of compile? broken pipe problem? laikos Programming 3 07-03-2004 07:08 PM
what to do with 5 parts of wget download Bruce Hill Linux - Software 2 09-11-2003 10:47 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:08 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration