The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Multi-line output to single line LinuxRacr Shell Programming and Scripting 7 02-26-2008 06:05 AM
AWK Multi-Line Records Processing RacerX Shell Programming and Scripting 10 10-18-2007 05:46 PM
need progress line esham Shell Programming and Scripting 0 03-17-2005 03:31 AM
Making multi line output appear on one line djsal Shell Programming and Scripting 1 10-07-2004 03:21 PM
Multi line deletes rehoboth UNIX for Dummies Questions & Answers 5 10-18-2002 12:39 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-29-2007
Registered User
 

Join Date: Oct 2007
Posts: 12
curser control ~ multi line progress bar

Hi there,

I have progress bars in several of my scripts, they work by deleting what has already been writen out, using:

clear = "\\010"*( length of string i want to delete )
clearCmd = "echo -ne \""+clear+"\""
os.system(clearCmd)

I then re-write the percent done & the progress bar.

in this way you can effectively create an animation, but only on one line.

if the teminal window is to small causeing the progressbar to run onto the next line, then the delete does not work, it will only go to the begining of the line it is on.

is there any way to move the curser up? allowing me to write over previous output on multiple lines?

any help would be most apriceated.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 10-29-2007
Moderator
 

Join Date: Dec 2003
Location: /ksh93
Posts: 849
The are many utilities out there that will do what you want. A lot of them are executables rather than shell scripts. Here is one for example

Command Line Progress Bar
Reply With Quote
  #3 (permalink)  
Old 10-29-2007
drl's Avatar
drl drl is online now
Registered User
 

Join Date: Apr 2007
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 477
Hi.

Perhaps you should consider scaling to prevent going past one line, so if you have an 80 character line, and are marking progress on 200 events, print a marker every 200 / 78 -> 3 events, producing a maximum of 67 characters.

If you don't know the number of events ahead of time, then a different display is needed, such as an actual count, followed by however many markers can fit on a line to give the idea of progress, erasing and repeating as necessary to prevent going to the next line ... cheers, drl
Reply With Quote
  #4 (permalink)  
Old 10-29-2007
Registered User
 

Join Date: Oct 2007
Posts: 12
yes - these are good answers,
but my question was not well explained i guess.

this is not a problem with the progress bars as they are, I actualy want to display more than one line, and be able to change them.

Prehaps it is not possible, but i was hopeing someone would know of an "curser up" command or bodge.
Reply With Quote
  #5 (permalink)  
Old 10-29-2007
drl's Avatar
drl drl is online now
Registered User
 

Join Date: Apr 2007
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 477
H.

I would look at tput for control of the terminal. You can use that in a shell script.

For more complex operations, there is the ncurses library. I think you'll need something along the lines of perl, python, or c for that ... cheers, drl
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 04:07 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0