Created
July 25, 2020 01:48
-
-
Save aussielunix/8094684f3770ed9e636915f751fd4418 to your computer and use it in GitHub Desktop.
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
# Run a command and present a spiiner whilst it completes | |
# | |
apt-get update -qq & # important to background command | |
pid=$! # get PID of backgrounded task | |
spin[0]="-" | |
spin[1]="\\" | |
spin[2]="|" | |
spin[3]="/" | |
echo -n "[updating APT sources] ${spin[0]}" | |
while kill -0 $pid 2>/dev/null | |
do | |
i=$(( (i+1) %4 )) | |
echo -ne "\b${spin[$i]}" | |
sleep 0.1 | |
done | |
echo -e "\bDONE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment