Last active
December 19, 2015 18:59
-
-
Save gld1982ltd/6002811 to your computer and use it in GitHub Desktop.
This script defines the public IP of Home and then checks the current public IP. If the current IP matches Home's IP, then one command is ran. If not, another command is ran.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# This script defines the public IP of Home and | |
# then checks the current public IP. If the current | |
# IP matches Home's IP, then one command is ran. | |
# If not, another command is ran. | |
# Public IP at home | |
HOME='YOUR HOME dedicated public IP address.' | |
IP=$(curl ifconfig.me/ip;) | |
if [[ "$IP" == "$HOME" ]]; then | |
echo "Home!" | |
else | |
echo "Away from Home!" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment