2023-04-02 19:05:29 +03:00

13 lines
489 B
Bash
Executable File

#!/bin/sh
# Displays the flag of the country you are in based on your public ip adress
#
# https://www.maketecheasier.com/ip-address-geolocation-lookups-linux/
ifinstalled "geoip" || exit
addr="$(curl ifconfig.me 2>/dev/null)" || exit
country="$(geoiplookup "$addr" | sed -e 's/^[^,]*, //' -e 's/,.*$//')" # Keep only between 1st and 2nd comma
grep "flag: $country" "${XDG_DATA_HOME:-$HOME/.local/share}/larbs/chars/emoji" |
sed 's/flag:.*//' # Remove everything from 'flag:' onward