Spinner

begin_spinner

Start an animated spinning cursor in the foreground (run in background with &). Stores its PID in $SpinPID so end_spinner can stop it.

Example

begin_spinner &
SpinPID="${!}"
some_long_task
end_spinner "$?"

Exit codes

  • 0: Always (loops indefinitely until killed)

end_spinner

Stop the spinner started by begin_spinner and print a status message based on the supplied exit code. Colour-coded if txtGrn/txtRed/txtRst are set.

Arguments

  • $1 (int): Exit code from the task that was running: 0, 1, 2, 124, or other

Exit codes

  • 0: Always