Sponsored Content
Top Forums Shell Programming and Scripting Bash Scripting: Adding runtime in a progress bar Post 303013598 by kristinu on Saturday 24th of February 2018 04:38:47 AM
Old 02-24-2018
Bash Scripting: Adding runtime in a progress bar

I have the following code that generates a progress bar and
want to add the current execution time after the percentage
value. The current execution time is stored in the variable `runtm`

I am having a problem on how to add `runtm` in the last `printf`
or after it.

Code:
   i=0; j=0
   totfcn=$(find $ipath -type f -name *hhz*.sac | tee /tmp/wrk | wc -l)

   for stfl in $(find $ipath -type f -name *hhz*.sac); do 
      printf -v XXX "%0*d" $((60 * ++i / totfcn))
      printf "\r[%-60s]" "${XXX//0/*}"
      printf "%4d%%" $((100 * ++j / totfcn))
   done

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

progress bar

i am trying to write a script where in it will connect to remote servers and execute remote scripts to fetch some data and ftp it back to a main server. i would like to add a script where it will show some sort of status bar until such time that the expected files have been recieved. something... (3 Replies)
Discussion started by: inquirer
3 Replies

2. UNIX for Advanced & Expert Users

progress bar

Hi all, I want to print # like that in a progress bar.. For e.g We can notice that during installation ... but,how to do that? Thnx, sakthi. (4 Replies)
Discussion started by: sakthi.abdullah
4 Replies

3. UNIX for Advanced & Expert Users

how to have a cp progress bar?

Hi all, This is a reformed post to my earlier ones!!!!!! I would like to know how to include a progress bar while using the cp... I am copying a few huge files from cdrom but am unable to figure out ,how to give a progress bar!!!!! I checked out other sites as well,but the issue here is... (1 Reply)
Discussion started by: wrapster
1 Replies

4. Shell Programming and Scripting

Progress bar

Hi friends, how can I show a progress bar for any running process in the shell script. For example when I am copying or compressing a file. Thanks. (1 Reply)
Discussion started by: dwiravi
1 Replies

5. Shell Programming and Scripting

progress bar

hi all, in shell script (ksh), how do i write a progress bar ?? i have a script which searches files and while its searching i am currently printing out "." and if it finds what its searching for the script prints out the name of the file e.g .................. firstFile.txt... (2 Replies)
Discussion started by: cesarNZ
2 Replies

6. Programming

A progress bar in C

Hello, it's me again...:eek: I need to create a progress bar in C, but i have no idea on how to do it. i want it to output something like this: Progress: 58% But i can't get it to work. Could you please post an example progress bar written in ANSI C? Thanks (4 Replies)
Discussion started by: Zykl0n-B
4 Replies

7. Shell Programming and Scripting

Progress bar for cp

I'm trying to use this code to get a progress bar for cp: "Can you get cp to give a progress bar like wget?" But I'm getting these errors: stat: illegal option -- c usage: stat awk: division by zero input record number 1, file source line number 4 I'm using Mac OS X 10.6... (1 Reply)
Discussion started by: pcwiz
1 Replies

8. Shell Programming and Scripting

Perl Progress BAR

Looking for a solution to why my progress bar not working My code print "STARTED:\n "; my $pdf = CAM::PDF->new('XYZ.pdf') or die $CAM::PDF::errstr; print STDOUT "Processing File: "; open (FILE, ">bill_data.txt") || die "Unable to save Bill_data.txt file"; for my $pagenum (1 ..... (4 Replies)
Discussion started by: chakrapani
4 Replies

9. Shell Programming and Scripting

Progress bar

Hi Experts; Im in the process of writing a shell script for enabling an IT operations to run archiving.We use netbackup. The script is complete, though there is one bit that i need help on. Im trying to have a progess bar for the procedure.I have gone through the man page of the command in... (5 Replies)
Discussion started by: maverick_here
5 Replies
ttk::progressbar(n)						 Tk Themed Widget					       ttk::progressbar(n)

__________________________________________________________________________________________________________________________________________________

NAME
ttk::progressbar - Provide progress feedback SYNOPSIS
ttk::progressbar pathName ?options? _________________________________________________________________ DESCRIPTION
A ttk::progressbar widget shows the status of a long-running operation. They can operate in two modes: determinate mode shows the amount completed relative to the total amount of work to be done, and indeterminate mode provides an animated display to let the user know that something is happening. STANDARD OPTIONS
-class -cursor -takefocus -style See the ttk_widget manual entry for details on the standard options. WIDGET-SPECIFIC OPTIONS [-orient orient] One of horizontal or vertical. Specifies the orientation of the progress bar. [-length length] Specifies the length of the long axis of the progress bar (width if horizontal, height if vertical). [-mode mode] One of determinate or indeterminate. [-maxi- mum maximum] A floating point number specifying the maximum -value. Defaults to 100. [-value value] The current value of the progress bar. In determinate mode, this represents the amount of work completed. In indeterminate mode, it is interpreted modulo -maximum; that is, the progress bar completes one "cycle" when the -value increases by -maximum. [-variable variable] The name of a Tcl variable which is linked to the -value. If specified, the -value of the progress bar is automatically set to the value of the variable whenever the latter is modified. [-phase phase] Read-only option. The widget periodically increments the value of this option whenever the -value is greater than 0 and, in determinate mode, less than -maximum. This option may be used by the current theme to provide additional animation effects. WIDGET COMMAND
pathName cget option Returns the current value of the specified option; see ttk::widget(n). pathName configure ?option? ?value option value ...? Modify or query widget options; see ttk::widget(n). pathName identify x y Returns the name of the element at position x, y. See ttk::widget(n). pathName instate statespec ?script? Test the widget state; see ttk::widget(n). pathName start ?interval? Begin autoincrement mode: schedules a recurring timer event that calls step every interval milliseconds. If omitted, interval defaults to 50 milliseconds (20 steps/second). pathName state ?stateSpec? Modify or query the widget state; see ttk::widget(n). pathName step ?amount? Increments the -value by amount. amount defaults to 1.0 if omitted. pathName stop Stop autoincrement mode: cancels any recurring timer event initiated by pathName start. SEE ALSO
ttk::widget(n) Tk 8.5 ttk::progressbar(n)
All times are GMT -4. The time now is 11:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy