Created
April 20, 2020 20:30
-
-
Save patrikalienus/99d38a3f38761d4a08769094e5a554a6 to your computer and use it in GitHub Desktop.
This file contains 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
#!/bin/bash | |
# <bitbar.title>alienus-external-ip</bitbar.title> | |
# <bitbar.desc>Gets your current external IP address. Uses ipify.org public API to do so.</bitbar.desc> | |
# <bitbar.author>Patrik Alienus</bitbar.author> | |
# <bitbar.author.github>patrikalienus</bitbar.author.github> | |
# Forked from https://github.com/matryer/bitbar-plugins/blob/master/Network/external-ip.1h.sh | |
# which does not work with VPNs, but this one does because it's uing the ipify.org API instead of a dig. | |
# Also changed slightly in the output to suit my minimalist tastes. | |
PUBLIC_IP=$(curl -s https://api.ipify.org) | |
if [ "$1" = "copy" ]; then | |
# Copy the IP to clipboard | |
echo -n "$PUBLIC_IP" | pbcopy | |
fi | |
echo "Public IP: $PUBLIC_IP" | |
echo "---" | |
echo "Copy $PUBLIC_IP | terminal=false bash='$0' param1=copy" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment