Skip to content

Instantly share code, notes, and snippets.

@mscharl
Last active May 2, 2018 06:03
Show Gist options
  • Save mscharl/84ad3524bae0242c275cfa37ab4b6ab2 to your computer and use it in GitHub Desktop.
Save mscharl/84ad3524bae0242c275cfa37ab4b6ab2 to your computer and use it in GitHub Desktop.
Script to fetch the external ip and write it to a file
export IP=$(curl --silent https://httpbin.org/ip 2>&1 | grep -Eo "([0-9]{1,3}.){3}[0-9]{1,3}")
export DATE=$(date +"%Y-%m-%d %H:%M")
echo "$DATE: $IP" >> ip.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment