dotfiles/script/myip

18 lines
250 B
Plaintext
Raw Normal View History

2021-04-03 09:08:41 +00:00
#!/usr/bin/env bash
#
# Print public IP address
set -e
2021-04-22 09:42:02 +00:00
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