dotfiles/bin/i3blocks/ip

6 lines
136 B
Bash
Executable file

#!/bin/bash
ip=$(dig +short myip.opendns.com @resolver1.opendns.com)
if [[ -z $ip || $ip == *"timed out"* ]]; then
exit
fi
echo $ip