Skip to main content
4 of 5
changed code, changed byte count
Abel Tom
  • 1.2k
  • 1
  • 7
  • 10

Bash 66 62 21 bytes##

ping -c1 g.gl echo $? 

Thanks @Alex L. for the URL shortening tip.

Ungolfed version:

r=$(ping -c1 g.gl) if [ $? -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