aboutsummaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-10-28 22:29:10 +0800
committerAaron LI <aly@aaronly.me>2017-10-28 22:29:10 +0800
commitaee4cff006f19d70e52067bd262abc2ccc3c8e3f (patch)
tree51e3f5e72b67eca87a917ae24234914c31208264 /cli
parentbcb6bca2c5b5f98338f21f928cd07332f004192c (diff)
downloadatoolbox-aee4cff006f19d70e52067bd262abc2ccc3c8e3f.tar.bz2
Add cli/get-ip.sh: A simple script to get public IPv4 address
Diffstat (limited to 'cli')
-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}