Advertisement
bogdanborovskij

mycheck

Feb 11th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.30 KB | None | 0 0
  1. #!/bin/bash
  2. date
  3. if [[ -f $1 ]] ; then
  4. hosts=$1
  5. else
  6. echo -e "google.com\nyahoo.com" > hosts
  7. hosts="./hosts"
  8. fi
  9. if [[ $# -eq 3 ]] ; then
  10. num=$2
  11. int=$3
  12. else
  13. num=3
  14. int=1
  15. fi
  16. cat $hosts | while read host
  17. do
  18. echo -n "$host - "
  19. ping $host -c $num -i $int | grep -oE "[0-9]+% packet loss"
  20. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement