Created
September 6, 2021 20:08
-
-
Save cirrusUK/6e3d10b7a7c190780c6ce3e1fdeed868 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
set -eu | |
declare -A T=( | |
[red]=$'\e[0;31m' [green]=$'\e[1;32m' [orange]=$'\e[1;33m' | |
[lightblue]=$'\e[0;34m' [purple]=$'\e[0;35m' [cyan]=$'\e[0;36m' | |
[lightgray]=$'\e[0;37m' [darkgray]=$'\e[1;30em' | |
[lightred]=$'\e[1;31m' [lightgreen]=$'\e[0;32m' | |
[yellow]=$'\e[0;49;93m' [blue]=$'\e[1;34m' | |
[lightpurple]=$'\e[1;35m' [lightcyan]=$'\e[1;36m' | |
[white]=$'\e[1;37m' [nc]=$'\e[0m' | |
) | |
test_it () { | |
curl -s --connect-timeout 1 -o /dev/null http://google.com/ | |
} | |
while true; do | |
if test_it; then | |
echo "${T[yellow]}Hey ${T[blue]}$USER ${T[yellow]}You Have ${T[green]}Internet access! π¦ β${T[nc]} π»" | |
sleep 1 | |
else | |
echo "${T[yellow]}Hey ${T[blue]}$USER ${T[yellow]}You Have${T[lightred]}No Internet access! π₯ β${T[nc]} π»" | |
sleep 2.5 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment