Skip to main content
1 of 5
Abel Tom
  • 1.2k
  • 1
  • 7
  • 10

Bash 66 bytes##

r=`ping -c1 google.com`if [ $r -ne 0 ]then echo "0"else echo "1"fi 

Ungolfed version:

r=`ping -c1 google.com` if [ $r -ne 0 ] then echo "0" else echo "1" fi 

This is my first answer in Bash , i'm not sure i have shortened the script enough.

Abel Tom
  • 1.2k
  • 1
  • 7
  • 10