diff options
| author | Luke Smith <luke@lukesmith.xyz> | 2023-04-20 08:47:39 -0400 |
|---|---|---|
| committer | Luke Smith <luke@lukesmith.xyz> | 2023-04-20 08:47:39 -0400 |
| commit | b719590427681e977b2a13e8490971e1e1b166b8 (patch) | |
| tree | 41f7d7c720d647cb2c5e17a2486f979dd232e2b4 /.local/bin/statusbar/sb-iplocate | |
| parent | 5a6c56d565e4e7c20171f5757e12306d9253c52b (diff) | |
| download | eibhear-b719590427681e977b2a13e8490971e1e1b166b8.tar.gz eibhear-b719590427681e977b2a13e8490971e1e1b166b8.tar.zst eibhear-b719590427681e977b2a13e8490971e1e1b166b8.zip | |
use built-ins, close #1297
Diffstat (limited to '.local/bin/statusbar/sb-iplocate')
| -rwxr-xr-x | .local/bin/statusbar/sb-iplocate | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/.local/bin/statusbar/sb-iplocate b/.local/bin/statusbar/sb-iplocate index 02adab8..a9043e3 100755 --- a/.local/bin/statusbar/sb-iplocate +++ b/.local/bin/statusbar/sb-iplocate @@ -5,6 +5,11 @@ # # https://www.maketecheasier.com/ip-address-geolocation-lookups-linux/ -ifinstalled "geoip" || exit -addr="$(curl ifconfig.me 2>/dev/null)" || exit -grep "flag: " "${XDG_DATA_HOME:-$HOME/.local/share}/larbs/emoji" | grep "$(geoiplookup "$addr" | sed 's/.*, //')" | sed "s/flag: //;s/;.*//" +set -e + +ifinstalled "geoip" +addr="$(geoiplookup "$(curl -sfm 1 ifconfig.me 2>/dev/null)")" +name="${addr##*, }" +flag="$(grep "flag: $name" "${XDG_DATA_HOME:-$HOME/.local/share}/larbs/emoji")" +flag="${flag%% *}" +printf "%s %s\\n" "$flag" "$name" |
