dotfiles/script/myip

18 lines
258 B
Bash
Executable File

#!/usr/bin/env bash
#
# Print public IP address
set -e
url='https://api.ipify.org?format=text'
if [ "$1" = "-c" ]; then
if [ "$(uname -s)" = "Darwin" ]; then
curl -s "$url" | pbcopy
else
curl -s "$url" | xclip -i
fi
else
curl -s "$url"
fi