need suggestion how to use the progress bar while executing shell

Dear All,

I need suggestions, I have below simple text based progress-bar script which will gradually increase the %.

#!/bin/ksh
i=50
echo "0--------20--------40-------60--------80-------100%"
while [ $i -ge 0 ]
do
echo -n "#"
sleep 1
i=`expr $i - 1`
done
echo

Now my problem is, how can I simultaneously use this with my wget functionality .

e.g. if I'm trying to execute wget and it takes normally 2-3min due to heavy file downloading, so instead showing blank screen I want to use this text bar that download is on progress..

how can I achieve this simultaneous execution ??

e.g.

Type MTM Date:<YYYYMMDD>
20120702
Started fetching 20120702 from www.xxx.zzz...
0--------20--------40-------60--------80-------100%
#############################

Hi.

Is there some reason that you do not use wget internal progress? As in:

       --progress=type
           Select the type of the progress indicator you wish to use.  Legal
           indicators are "dot" and "bar".
-- excerpt from man wget

cheers, drl

Hi drl,

thank you, I know I sounded like I want to use the bar for wget but actually
I meant wget as an example, but there are loads other option/scripts where I need to use/call/execute simultaneously two shells like copy a heavy one/execute a script and then same time display the bar.......while one thing is in progress ....

Hi.

I have used pv with success:

NAME
       pv - monitor the progress of data through a pipe
-- excerpt from man pv, q.v.

and pv was in my Debian repository.

You might also be able to use bar:

# @(#) bar      Copy file as with cat, show progress bar to STDERR.
# See http://www.theiling.de/projects/bar.html

There are a lot of other progress mechanisms. I don't recall if any will simply monitor a process -- those might be useful when you you cannot use a pipeline, for example, but would probably use a spinner to show that the process was still active.

Good luck ... cheers, drl

---------- Post updated at 05:50 ---------- Previous update was at 05:25 ----------

Hi.

There are a number of progress suggestions at BASH progress basr or animation ... cheers, drl