1
0
Fork 0
dotfiles/.local/libexec/statusbar/sb-ip

7 lines
384 B
Plaintext
Raw Normal View History

2022-09-15 20:27:44 +02:00
#!/bin/sh
# https://www.maketecheasier.com/ip-address-geolocation-lookups-linux/
2022-09-21 21:46:27 +02:00
loc_addr="$(ip route get 9.9.9.9 | head -1 | cut -d ' ' -f7)"
2022-09-27 10:47:14 +02:00
pub_addr="$(curl ipv4.icanhazip.com 2>/dev/null)" || exit
2022-09-17 16:46:33 +02:00
# flag="$(grep "flag: " "${XDG_DATA_HOME:-$HOME/.local/share}/emoji" | grep "$(geoiplookup "$addr" | sed 's/.*, //')" | sed 's/ flag: .*//')"
printf "%s %s\n" "$loc_addr" "$pub_addr"