Created
June 14, 2021 15:27
-
-
Save dmi3mis/62f5e91afc1cde84fa1d6600165dc859 to your computer and use it in GitHub Desktop.
This file contains 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 | |
# this sample script is ping computers in loop. | |
# It uses conditional expression with color echo | |
for HOST in $(seq $1 $2) | |
do | |
echo -en "\nlets try ping $HOST: " | |
if ping -c 1 -W 1 f${HOST} >/dev/null 2>&1 | |
then | |
echo -e "\e[1;32m alive \e[0m" | |
else | |
echo -e "\e[1;41m DEAD \e[0m" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment