Home Man
Search
Today's Posts
Register

BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Spinning bar status while doing something.

Tags
shell scripts, spinng bar status script

Login to Reply

 
Thread Tools Search this Thread
# 1  
Old 07-07-2009
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,
# 2  
Old 07-07-2009
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.
# 3  
Old 07-07-2009
Doh!

Unfortunately, we're using ksh88. Any suggestions on what to do here?
Login to Reply

« Previous Thread | Next 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
PID status ultimatix Shell Programming and Scripting 4 03-22-2010 01:01 PM
Status of NIC warlock129 Shell Programming and Scripting 2 05-07-2009 01:10 PM
How to see HW status. vettec3 Red Hat 3 03-23-2009 10:04 AM
Custom Spinning Your own Open solaris FloridaBSD Solaris 1 11-11-2008 04:01 PM
Display spinning cursor while waiting kelldan Shell Programming and Scripting 6 08-15-2008 01:26 PM
Installing RedHat 8.0 onto Dell PowerEdge SC1425 - hdc: status error: status = 0x58 fishsponge Red Hat 5 07-14-2006 02:53 PM
check the status and send an email with status isingh786 Shell Programming and Scripting 3 12-29-2005 06:22 PM
FTP status shah2 Shell Programming and Scripting 5 10-22-2004 05:42 AM
FTP Status rvprod Shell Programming and Scripting 1 01-29-2002 02:30 PM
Couldn't open status file /var/samba/STATUS.LCK macdonto UNIX for Dummies Questions & Answers 2 08-08-2001 08:42 AM


All times are GMT -4. The time now is 04:43 AM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.
UNIX.COM Login
Username:
Password:  
Show Password