Skip to content

Instantly share code, notes, and snippets.

@forsgren
Forked from victorfsf/spinner.zsh
Created October 20, 2023 06:07
Show Gist options
  • Save forsgren/81a353b9509e4484bf419d10e9c1e3be to your computer and use it in GitHub Desktop.
Save forsgren/81a353b9509e4484bf419d10e9c1e3be to your computer and use it in GitHub Desktop.
#!/usr/bin/env zsh
sleep 10 &!
pid=$! # Process Id of the previous running command
spin='⠋⠙⠚⠞⠖⠦⠴⠲⠳⠓'
i=0
while kill -0 $pid 2>/dev/null; do
i=$(((i + 1) % 10))
printf "$fg[magenta]\r${spin:$i:1}"
printf "$fg[white] Waiting..."
sleep .1
done
printf "\r$fg[green]✓\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment