Spinning bar status while doing something.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Spinning bar status while doing something.
# 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 or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Ncurses status bar

Hi, all, I'm writing a BBS telnet client, and am trying to implement a status bar into it, at the bottom of the screen. I am using NCurses to accomplish this. So far, it appears to be working, that is, upon connecting to BBS, it will display the status bar, and then quickly disappear. ... (5 Replies)
Discussion started by: ignatius
5 Replies

2. Programming

How to track table status delete/update/insert status in DB2 V10 z/os?

Dear Team I am using DB2 v10 z/os database . Need expert guidance to figure out best way to track table activities ( Ex Delete, Insert,Update ) Scenario We have a table which is critical and many developer/testing team access on daily basis . We had instance where some deleted... (1 Reply)
Discussion started by: Perlbaby
1 Replies

3. AIX

IBM P730 running AIX 7.1 (8231-E2B) - Fans spinning loud/max rpm?

We have a IBM P730 machine running AIX 7.1 in a properly air cooled server room. Just recently the fans on the unit kicked into overdrive, they are very loud and spinning at max. Typically this happens when the server first boots then they normalize. However for some odd reason, they sound... (2 Replies)
Discussion started by: c3rb3rus
2 Replies

4. Ubuntu

Why icon in status bar is disabled?

Below the list of command to explain the status michelangeli@hp:~$ lspci -nn | grep -i net 02:00.0 Ethernet controller : Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 03) 04:00.0 Network controller : Ralink corp. RT2790 Wireless 802.11n 1T/2R... (6 Replies)
Discussion started by: michelangeli
6 Replies

5. Shell Programming and Scripting

Replace space and vertical bar with verical bar

I am trying to get sed, tr or awk to search a file that contains records with fields delimited by the vertical bar | and replace the occurrences in the records where the vertical bar is preceded by a space " |" with a vertical bar. Sample data record zelli |||59 Stonewall Dr ||W Barnstable |MA... (2 Replies)
Discussion started by: clintrpeterson
2 Replies

6. Shell Programming and Scripting

status bar in shell script or perl

How To Generate different different progress bar in shell script? like we install some software it show us progress, like we install RPM that also show us progress. Thanks, Bash (2 Replies)
Discussion started by: learnbash
2 Replies

7. Solaris

Custom Spinning Your own Open solaris

I was wondering, If it is at all possible to spin my own custom opensolrais boot disc? The reason i ask is becausrwe i am running Open Solaris on a AMD 64 bit based system and neet flash and MPeg support right out of the box. A prompt answer Is much appreciated. (1 Reply)
Discussion started by: FloridaBSD
1 Replies

8. Shell Programming and Scripting

Display spinning cursor while waiting

Hi All, I have a script, very basic, that checks the the intergrity of tar files. Of course, with a huge amount of files, this might take a while. So I'd like to have the script display the spinning cursor while this happens. I'm just not sure how to go about scripting this under ksh. Can... (6 Replies)
Discussion started by: kelldan
6 Replies

9. Red Hat

Installing RedHat 8.0 onto Dell PowerEdge SC1425 - hdc: status error: status = 0x58

I have successfully installed RedHat 8.0 onto a Dell PowerEdge SC1425 today. This server has two SATA hard drives, and an IDE DVD-ROM drive. Using the following kernel parameters, i successfully installed across both hard drives from CD: ide0=0x1f0,0x3f6,14 vga=791 resolution=1024x768 expert... (5 Replies)
Discussion started by: fishsponge
5 Replies

10. UNIX for Dummies Questions & Answers

Couldn't open status file /var/samba/STATUS.LCK

I believe i have most of samba configured right but i get this error each time time try to run it. I was given suggestion that i touch the file, i did, but i still cannot rid myself of this error. Any suggestions (2 Replies)
Discussion started by: macdonto
2 Replies
Login or Register to Ask a Question