++ed by:
1 non-PAUSE user
Author image Joe Cooper
and 1 contributors


spinner - A command to print a spinner and wait for a signal to stop.


One-liner from a POSIX-y shell:

    # spinner & PID=$!; sleep 5; kill $PID

In a POSIX-y script:

    spinner &
    # Do some stuff
    sleep 5
    kill $PID

In the above examples, "sleep 5" would be replaced with whatever long-running work you need to do. It can be one command or many.


This command can be used in shell scripts to print a spinner while you do stuff in the background. Once you've completed your work, you stop the spinner by sending a signal to the PID of the spinner process.

If you're working with Perl, you should use the Term::Spinner::Color module directly instead. If you prefer a pure-shell implementation, I've also built https://github.com/swelljoe/spinner which has nearly identical behavior, but only requires a POSIX-y shell.