system/modules/home-manager/configs/window-manager/scripts/external_ip.sh

12 lines
232 B
Bash
Raw Permalink Normal View History

#!/usr/bin/env bash
2023-07-28 17:08:13 +03:00
res=$(dig +timeout=3 +retry=0 +short myip.opendns.com @resolver1.opendns.com 2>/dev/null)
2023-06-16 11:03:56 +03:00
if [ -z "$res+x" ]; then
text="NO CONN"
echo "%{F@error@}${text}%{F-}"
exit 0
fi
echo "%{F@success@}${res}%{F-}"