Created
August 11, 2021 21:48
-
-
Save cig0/dac3c0a7ddfebf70198026670256652b to your computer and use it in GitHub Desktop.
Braile spinner for shell scripts -- Taken from https://github.com/pacstall/pacstall/issues/68
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Copyright Notice: | |
# This spinner script has been taken from | |
# https://github.com/pacstall/pacstall/issues/68 | |
spin() | |
{ | |
spinners=(⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇ ⠏) | |
msg=$1 | |
fg="\e[34m" | |
reset_color="\e[0m" | |
# hide cursor | |
tput civis | |
while true | |
do | |
for spinner in "${spinners[@]}" | |
do | |
sleep 0.05 | |
printf " $fg$spinner$reset_color \e[1m$msg\r" 2>/dev/null | |
done | |
done | |
# show cursor | |
tput cnorm || true | |
} | |
spin "Updating something" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
F/LOSS FTW!
Some of us never forget, Microsh*t: https://www.theregister.com/2019/06/27/microsoft_linux_distro_list/