]> git.rmz.io Git - dotfiles.git/commitdiff
bin: fix whatsmyip script
authorSamir Benmendil <me@rmz.io>
Sun, 24 Nov 2019 14:14:22 +0000 (14:14 +0000)
committerSamir Benmendil <me@rmz.io>
Sun, 24 Nov 2019 14:14:22 +0000 (14:14 +0000)
bin/whatsmyip

index 5f0479f780c3d902700f105da322bc253a8c1344..288e3b3f7b30f90516c611a120effa760644b390 100755 (executable)
@@ -1,8 +1,8 @@
 #!/bin/bash
 
 if hash drill 2>/dev/null; then
-    drill +short myip.opendns.com @resolver1.opendns.com
-if hash dig 2>/dev/null; then
+    drill myip.opendns.com @resolver1.opendns.com | grep "^myip." | cut -f5
+elif hash dig 2>/dev/null; then
     dig +short myip.opendns.com @resolver1.opendns.com
 elif hash curl 2>/dev/null; then
     curl -s ifconfig.me/ip