diff --git a/script/myip b/script/myip index c5bc450..c67840a 100755 --- a/script/myip +++ b/script/myip @@ -3,4 +3,15 @@ # Print public IP address set -e -curl -s 'https://api.ipify.org?format=text' + +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