Linux Today: Linux News On Internet Time.

Creating a Bash Spinner

Jun 15, 2009, 13:02 (4 Talkback[s])
(Other stories by Mitch Frazier)

"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.

"In addition the spinner reads from a log file created by the main process and displays the last line from the log file next to the spinner. When the log file goes away the spinner exits.

"This is the script for the main process, called runner.sh:"

Complete Story

Related Stories: