# Print my public IP dig +short myip.opendns.com @resolver1.opendns.com # Output 77.122.128.246 # Store IP in Bash Variable myip="$(dig +short myip.opendns.com @resolver1.opendns.com)"