"Need progress mechanism for copy process"

Hello Folks,

I got an issue to be solved. I need to show the user a progress bar while executing an process using shell script

Example:

While updating firmware lets assume this will take 2 min to upgrade i need the shell script to show the progress bar as (0%) and at the end it should display (100%).

I searched for this in the forms and found they are some threads to show progress bar while copying the file my case is while upgrading an firmware i need to display this.

Thanks in Advance,
Phani.

For an ouput on the terminal

for I in $(seq 100)
do
     echo -n '='
     sleep 0.5
done

With zenity on GUI

(
    for I in $(seq 100)
    do
        echo $I
        sleep 0.5
    done
) | zenity --progress

You can adjust the value in the sleep statement to match your needs.
In the above example, it will complete in 50 seconds.

I saw a link to this URL posted on the forums - ivarch.com: Pipe Viewer via ( A Unix Utility You Should Know About: Pipe Viewer - good coders code, great reuse )

So you found other threads explaining how to make a progress bar. During the process you need to know how to measure progress in relation to the finished state. The criterion you mention is time, so at any point in time you can define progress as elapsed time divided by 2 minutes.

How can this be shown in % (percentage)

example: 0% to 100%

---------- Post updated at 02:00 PM ---------- Previous update was at 01:54 PM ----------

We can use "pv" pipe viewer to show progress bar but in every distro this "pv" is not default we should install this pv package. Help me to solve this issue without using "pv" option

As in my first suggestion

(
    for I in $(seq 120) # assume that it will take 2 minutes
    do
        echo $((I*5/6)) # at 120 it will give 100 (%)
        sleep 1
    done
) | zenity --progress

But it doesn't monitor the real process, it's just a time indicator.

How can we show the real progress of the process?

For that you need to know how to measure progress of the installation process in relation to the finished state. What makes it 20% or 10% or 50% or 80%. You need to define that yourself.

Hi All,
If I run the script,

for I in $(seq 100)
do
echo -n '='
sleep 0.5
done

It shows error as below,
seq: not found

How this can be resolved?

pv ?

How can we show the real progress of the process?

phanivarma,
you've been given multiple hints already and you keep asking the same question.
what is there in the previous posts that is not clear to you?
Please be specific.

hello all
i need quick help
i need to write program in c ,which ll use process and fork() .the program must wait user to enter number each 1 second
and add it to the previous entered value
as seen
1: Enter value?1
2: Enter value? 3
5: Enter value?9
14: Enter value?

and soon on u
plz any one has an idea

Please, don't hijack other people threads - start your own!