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 and shell scripting languages 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 10:05 AM
AWK Multi-Line Records Processing RacerX Shell Programming and Scripting 10 10-18-2007 09:46 PM
need progress line esham Shell Programming and Scripting 0 03-17-2005 07:31 AM
Making multi line output appear on one line djsal Shell Programming and Scripting 1 10-07-2004 07:21 PM
Multi line deletes rehoboth UNIX for Dummies Questions & Answers 5 10-18-2002 04:39 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-29-2007
purest purest is offline
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.
  #2 (permalink)  
Old 10-29-2007
fpmurphy's Avatar
fpmurphy fpmurphy is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2003
Location: Florida
Posts: 1,930
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
  #3 (permalink)  
Old 10-29-2007
drl's Avatar
drl drl is offline Forum Advisor  
Registered User
  
 

Join Date: Apr 2007
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 712
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
  #4 (permalink)  
Old 10-29-2007
purest purest is offline
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.
  #5 (permalink)  
Old 10-29-2007
drl's Avatar
drl drl is offline Forum Advisor  
Registered User
  
 

Join Date: Apr 2007
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 712
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
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:58 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0