Created
January 13, 2016 10:27
-
-
Save moozer/8d53d17680c27ffa0570 to your computer and use it in GitHub Desktop.
ping check - simple bash script to ping host list from file
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 | |
# googling | |
# "bash read line by line from file" | |
# gave me this: | |
# http://stackoverflow.com/questions/10929453/bash-scripting-read-file-line-by-line | |
# file which contains one hostname or ip per line | |
FILENAME="hosts" | |
while IFS='' read -r LINE || [[ -n "$LINE" ]]; do | |
echo "Checking $LINE" | |
ping -c 1 $LINE | |
done < "$FILENAME" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment