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.