2023-06-15 11:33:59 +03:00
|
|
|
#!/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
|
2023-06-15 11:33:59 +03:00
|
|
|
text="NO CONN"
|
|
|
|
echo "%{F@error@}${text}%{F-}"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "%{F@success@}${res}%{F-}"
|
|
|
|
|