aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xcli/get-ip.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/cli/get-ip.sh b/cli/get-ip.sh
new file mode 100755
index 0000000..3bfc660
--- /dev/null
+++ b/cli/get-ip.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# Get the public IPv4 address.
+#
+# Credit:
+# * http://ifconfig.me/
+# * http://ipecho.net/
+#
+# Aaron LI
+# 2017-08-31
+# MIT license
+#
+
+URL="http://ifconfig.me"
+URL="http://ipecho.net/plain"
+
+ip=$(curl -s ${URL})
+echo ${ip}