#!/bin/bash

#==================================================
# Spinner
# See: http://fitnr.com/showing-a-bash-spinner.html
#==================================================
spinner() {
    pid=$! # Process Id of the previous running command

    spin='-\|/'

    i=0
    while kill -0 $pid 2>/dev/null
    do
      i=$(( (i+1) %4 ))
      printf "\r${spin:$i:1} "
      sleep .1
    done
    printf "\b\b"
}
