Creating a Bash Spinner

648
Article Source Linux Journal
June 9, 2009, 8:49 am

Do you know what this sequence of characters “/-|/-|” is for? A text based spinner. Still confused, read on.

You’ve probably seen some long running console program that shows a spinner while it runs. A spinner being the aforementioned sequence of characters output one after the other at the same place on the screen with a pause between each character. The code in this article creates a spinner which runs in a separate process. By doing this the spinner spins at a constant rate and doesn’t pause when your script pauses. It also eliminates the need to sprinkle spinner output messages throughout your program…