ping.test 428 B

1234567891011121314151617181920212223242526272829
  1. #!/usr/bin/env bash
  2. # ping.test
  3. # defaults
  4. server=www.wolfssl.com
  5. tries=2
  6. # populate args
  7. if [ "$#" -gt 1 ]; then
  8. tries=$2
  9. fi
  10. if [ "$#" -gt 0 ]; then
  11. server=$1
  12. fi
  13. # determine os
  14. OS="`uname`"
  15. case $OS in
  16. MINGW* | MSYS*) PINGSW=-n ;;
  17. *) PINGSW=-c ;;
  18. esac
  19. # is our desired server there?
  20. ping $PINGSW $tries $server
  21. RESULT=$?
  22. [ $RESULT -ne 0 ] && echo -e "\n\nCouldn't find $server, skipping" && exit 1
  23. exit 0