Created
May 5, 2024 07:30
-
-
Save sydrawat01/73078d12a9c7490921909680715b2004 to your computer and use it in GitHub Desktop.
Speedtest from the terminal
This file contains hidden or 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 | |
| # Function to display spinner animation | |
| spinner() { | |
| local pid=$! | |
| local delay=0.1 | |
| #local spin='|/-\' | |
| local spin='x+' | |
| while ps -p $pid >/dev/null; do | |
| printf "[%c] " "$spin" | |
| spin=${spin#?}${spin%???} | |
| sleep $delay | |
| printf "\b\b\b\b\b\b" | |
| done | |
| printf " \b\b\b\b" | |
| } | |
| # Run your command in the background | |
| curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | /usr/bin/python3 - --simple & | |
| # Show spinner animation while waiting for output | |
| spinner | |
| # Wait for the command to finish and get its output | |
| wait $! | |
| exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment