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

12 lines
221 B
Bash
Raw Normal View History

#!/usr/bin/env bash
res=$(dig +timeout=1 +short myip.opendns.com @resolver1.opendns.com 2>/dev/null)
if [ -z "$res" ]; then
text="NO CONN"
echo "%{F@error@}${text}%{F-}"
exit 0
fi
echo "%{F@success@}${res}%{F-}"