Creating a Bash Spinner

Written By
MF
Mitch Frazier
Jun 15, 2009

“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

MF

Mitch Frazier

Linux Today Logo

LinuxToday is a trusted, contributor-driven news resource supporting all types of Linux users. Our thriving international community engages with us through social media and frequent content contributions aimed at solving problems ranging from personal computing to enterprise-level IT operations. LinuxToday serves as a home for a community that struggles to find comparable information elsewhere on the web.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.