wanip() {
wget -q -O - checkip.dyndns.com | awk '{print $6}'| sed 's/<.*>//'
}
if [ -f ~/.bash_func ]; then
. ~/.bash_func
fi
Source: https://habr.com/ru/post/121136/