Skip to content

fix two compatibility issues #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions spinner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function _spinner() {
# calculate the column where spinner and status msg will be displayed
let column=$(tput cols)-${#2}-8
# display message and position the cursor in $column column
echo -ne ${2}
printf "${2}"
printf "%${column}s"

# start spinner
Expand All @@ -49,29 +49,29 @@ function _spinner() {

while :
do
printf "\b${sp:i++%${#sp}:1}"
printf "\b${sp:$((i++%${#sp})):1}"
sleep $delay
done
;;
stop)
if [[ -z ${3} ]]; then
echo "spinner is not running.."
printf "spinner is not running..\n"
exit 1
fi

kill $3 > /dev/null 2>&1

# inform the user uppon success or failure
echo -en "\b["
printf "\b["
if [[ $2 -eq 0 ]]; then
echo -en "${green}${on_success}${nc}"
printf "${green}${on_success}${nc}"
else
echo -en "${red}${on_fail}${nc}"
printf "${red}${on_fail}${nc}"
fi
echo -e "]"
printf "]\n"
;;
*)
echo "invalid argument, try {start/stop}"
printf "invalid argument, try {start/stop}\n"
exit 1
;;
esac
Expand Down