Spinning bar status while doing something. | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


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

Spinning bar status while doing something.

Shell Programming and Scripting


Tags
spinng bar status script

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 07-07-2009
mrwatkin mrwatkin is offline
Registered User
 
Join Date: Jun 2009
Last Activity: 6 September 2012, 1:20 PM EDT
Posts: 81
Thanks: 0
Thanked 1 Time in 1 Post
Spinning bar status while doing something.

After some googling, I came across this script to create a spinning cursor:

Code:
#!/bin/bash

# paste following in your script
declare -a Spinner

Spinner=(/ - \\ \| / - \\ \| )
Spinnerpos=0

update_spinner()
{
    printf "\b"${Spinner[$Spinnerpos]}
    (( Spinnerpos=(Spinnerpos +1)%8 ))
}

# testing :

printf "Spinner :  "

update_spinner
sleep 1
update_spinner
sleep 1
update_spinner
sleep 1
update_spinner
sleep 1
update_spinner
sleep 1
update_spinner
sleep 1
update_spinner
sleep 1
update_spinner
sleep 1
update_spinner
sleep 1
update_spinner
sleep 1
update_spinner
sleep 1
update_spinner


I'd like to be able to make use of a spinning cursor in one of my scripts while the script does it's work (ssh to another server, maybe unzip and copy some files, etc.)

Any idea how to do this? I'll probably be using ksh instead of bash, but I think think that will make that big of a difference.

If anyone know of a way to make a faster spinning cursor, I'd like that as well.

Thanks in advance,
Sponsored Links
    #2  
Old 07-07-2009
fpmurphy's Avatar
fpmurphy fpmurphy is offline Forum Staff  
who?
 
Join Date: Dec 2003
Last Activity: 18 December 2014, 8:26 PM EST
Location: /dev/ph
Posts: 4,842
Thanks: 64
Thanked 434 Times in 402 Posts
If you are using ksh93, you could use the undocumented alarm function to asynchronously update a progress bar or a spinner. Milliseconds are supported.

See KSH93 Alarm Built-in for more information.
Sponsored Links
    #3  
Old 07-07-2009
mrwatkin mrwatkin is offline
Registered User
 
Join Date: Jun 2009
Last Activity: 6 September 2012, 1:20 PM EDT
Posts: 81
Thanks: 0
Thanked 1 Time in 1 Post
Doh!

Unfortunately, we're using ksh88. Any suggestions on what to do here?
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Custom Spinning Your own Open solaris FloridaBSD Solaris 1 11-11-2008 05:01 PM
Display spinning cursor while waiting kelldan Shell Programming and Scripting 6 08-15-2008 02:26 PM
Installing RedHat 8.0 onto Dell PowerEdge SC1425 - hdc: status error: status = 0x58 fishsponge Red Hat 5 07-14-2006 03:53 PM
check the status and send an email with status isingh786 Shell Programming and Scripting 3 12-29-2005 07:22 PM
Couldn't open status file /var/samba/STATUS.LCK macdonto UNIX for Dummies Questions & Answers 2 08-08-2001 09:42 AM



All times are GMT -4. The time now is 08:54 AM.