#!/bin/bash
# return "|", "/", "-", "\" sequentially with each call to this script.
# Use /tmp/last-text-spinner to store last used
FILE="/tmp/last-text-spinner"
if ! [ -f $FILE ]; then
echo "|" > $FILE
exit 124 # ASCII equivalent for "|" bash doesn't allow character return codes
fi
LAST=$(cat $FILE) # read last character used
if [[ $LAST=="|" ]]; then
echo "/" > $FILE
exit 47 # ASCII equivalent
elif [[ $LAST=="/" ]]; then
echo "-" > $FILE
exit 45 # ASCII
elif [[ $LAST=="-" ]]; then