Skip to content

Instantly share code, notes, and snippets.

@dmi3mis
Created June 14, 2021 15:27
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 dmi3mis/62f5e91afc1cde84fa1d6600165dc859 to your computer and use it in GitHub Desktop.
Save dmi3mis/62f5e91afc1cde84fa1d6600165dc859 to your computer and use it in GitHub Desktop.
#!/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