system/home/modules/window_manager/scripts/external_ip.sh

12 lines
223 B
Bash
Raw Normal View History

#!/usr/bin/env bash
res=$(dig +timeout=1 +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-}"