Skip to content

Instantly share code, notes, and snippets.

@sween
Created March 11, 2023 12:10
Show Gist options
  • Save sween/99a4ef5e17a82bec9cc27a319cb9dcb9 to your computer and use it in GitHub Desktop.
Save sween/99a4ef5e17a82bec9cc27a319cb9dcb9 to your computer and use it in GitHub Desktop.
spinner.sh
/usr/bin/scp [email protected]:file somewhere 2>/dev/null &
pid=$! # Process Id of the previous running command
spin[0]="-"
spin[1]="\\"
spin[2]="|"
spin[3]="/"
echo -n "[copying] ${spin[0]}"
while [ kill -0 $pid ]
do
for i in "${spin[@]}"
do
echo -ne "\b$i"
sleep 0.1
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment