Skip to content

Instantly share code, notes, and snippets.

@Habibu-R-ahman
Created August 3, 2020 14:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Habibu-R-ahman/2a05f158db81914f3a3a1c4311c2d352 to your computer and use it in GitHub Desktop.
Save Habibu-R-ahman/2a05f158db81914f3a3a1c4311c2d352 to your computer and use it in GitHub Desktop.
Simple Speed Test
#!/bin/bash
Speed() {
local anu=$(ping google.com -c 1 | grep -o "time=[0-9]*")
local NUMBER=$(echo ${anu//[^0-9]/})
echo $NUMBER
}
echo -e "Enter Number of Test Case : \c"
read n
while (( n-- ))
do
t=$(Speed)
if (( $t < 20 ))
then
echo -e "\e[92mSuper Sonic!" #light green
elif (( $t > 20 && $t < 70 ))
then
echo -e "\e[32mStrong!" #green
elif (( $t > 70 && $t < 150 ))
then
echo -e "\e[97mok" #white
elif (( $t > 150 && $t < 250 ))
then
echo -e "\e[34mSlow but ok"
elif (( $t > 250 && $t < 500 ))
then
echo -e "\e[34mSlow"
else
echo -e "\e[31mPoor Connection..."
fi
done
echo -e "\e[39mDone"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment