Last active
April 24, 2024 01:04
-
-
Save dreambo4/b189aeff8ede85e8fcdd73651195f775 to your computer and use it in GitHub Desktop.
Thanks chatGPT!
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 | |
# Replace with the IP address you want to ping | |
IPArray=( | |
"192.168.0.1" | |
"192.168.0.2" | |
"192.168.0.3" | |
"192.168.0.4" | |
"192.168.0.5" | |
) | |
COUNT=1 # Number of ping attempts | |
TIMEOUT=5 # Ping timeout in seconds | |
for IP in "${IPArray[@]}"; do | |
if ping -c $COUNT -W $TIMEOUT "$IP" > /dev/null 2>&1; then | |
echo "Ping to $IP was successful." | |
else | |
echo "Ping to $IP failed." | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment