-
-
Save giig982/b5c7e70489ce6f920a98b2482ac4bebe to your computer and use it in GitHub Desktop.
ping check - simple bash script to ping host list from file
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
| #!/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