Add -c option to myip script

This commit is contained in:
Rob Watson 2021-04-22 11:42:02 +02:00
parent 570b8a5b5e
commit e593efc410
1 changed files with 12 additions and 1 deletions

View File

@ -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