18 lines
258 B
Plaintext
Raw Normal View History

2021-04-03 11:08:41 +02:00
#!/usr/bin/env bash
#
# Print public IP address
set -e
2021-04-22 11:42:02 +02:00
url='https://api.ipify.org?format=text'
if [ "$1" = "-c" ]; then
2023-10-07 10:43:32 +02:00
if [ "$(uname -s)" = "Darwin" ]; then
curl -s "$url" | pbcopy
2021-04-22 11:42:02 +02:00
else
2023-10-07 10:43:32 +02:00
curl -s "$url" | xclip -i
2021-04-22 11:42:02 +02:00
fi
else
2023-10-07 10:43:32 +02:00
curl -s "$url"
2021-04-22 11:42:02 +02:00
fi