From aee4cff006f19d70e52067bd262abc2ccc3c8e3f Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Sat, 28 Oct 2017 22:29:10 +0800 Subject: Add cli/get-ip.sh: A simple script to get public IPv4 address --- cli/get-ip.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 cli/get-ip.sh (limited to 'cli') 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} -- cgit v1.2.2