Created
November 12, 2018 15:43
-
-
Save aklowther/63857cf71ada63e368fba6a4d7c5b901 to your computer and use it in GitHub Desktop.
Original script link is below. I modified it to show both my IPv4 and IPv6 external addresses on separate lines http://dferg.us/ip-address-workflow/
This file contains hidden or 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
LOCAL=$(ifconfig | grep -A 1 "en" | grep broadcast | cut -d " " -f 2 | tr "\\n" " ") | |
EXTERNAL6=$(curl --silent http://icanhazip.com -6) | |
EXTERNAL4=$(curl --silent http://icanhazip.com -4) | |
cat<<EOB | |
<?xml version="1.0"?> | |
<items> | |
<item uid="localip" arg="$LOCAL"> | |
<title>Local IP: $LOCAL</title> | |
<subtitle>Press Enter to paste, or Cmd+C to copy</subtitle> | |
<icon>icon.png</icon> | |
</item> | |
<item uid="externalip6" arg="$EXTERNAL6"> | |
<title>External IPv6: $EXTERNAL6</title> | |
<subtitle>Press Enter to paste, or Cmd+C to copy</subtitle> | |
<icon>icon.png</icon> | |
</item> | |
<item uid="externalip4" arg="$EXTERNAL4"> | |
<title>External IPv4: $EXTERNAL4</title> | |
<subtitle>Press Enter to paste, or Cmd+C to copy</subtitle> | |
<icon>icon.png</icon> | |
</item> | |
</items> | |
EOB |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment