aboutsummaryrefslogtreecommitdiff
path: root/local
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2017-10-21 15:03:59 +0200
committerKarel Kočí <cynerd@email.cz>2017-10-21 15:03:59 +0200
commit7d68f4b5f7adf9b2338055baa5e0bd1073c103a7 (patch)
tree95c722b05d7d004279461d74a6cd348b650a1ccc /local
parentfc2b873546980bfad62b54575cdb0d40fae895c3 (diff)
downloadmyconfigs-7d68f4b5f7adf9b2338055baa5e0bd1073c103a7.tar.gz
myconfigs-7d68f4b5f7adf9b2338055baa5e0bd1073c103a7.tar.bz2
myconfigs-7d68f4b5f7adf9b2338055baa5e0bd1073c103a7.zip
In surf-menu use getent instead of nslookup
Diffstat (limited to 'local')
-rwxr-xr-xlocal/bin/surf-menu12
1 files changed, 5 insertions, 7 deletions
diff --git a/local/bin/surf-menu b/local/bin/surf-menu
index f4925f8..b2e0111 100755
--- a/local/bin/surf-menu
+++ b/local/bin/surf-menu
@@ -25,14 +25,12 @@ run() {
LHOST="$(echo "$1" | sed -n 's#^[^:]*://##;s#^\([^/]\+\)/\?.*#\1#p')"
LPATH="$(echo "$1" | sed 's#^[^:]*://##;s#^[^/]\+/\?##')"
- # Try to lookup if it's an real address
- # Note: This is hack because of youtube, nslookup return No answer but
- # exists with 0. So I am checking if it returned more than one address
- # (one address is for dns server).
- if [ "$(nslookup "$LHOST" | grep 'Address:' | wc -l)" -le 1 ]; then # It's a real address
- if nslookup "$LHOST.cz" >/dev/null; then # we can expand it with cz
+ if ! getent hosts "$LHOST" >/dev/null; then
+ if getent hosts "$LHOST.cz" >/dev/null; then
LHOST="$LHOST.cz"
- elif nslookup "$LHOST.com" >/dev/null; then # we can expand it with com
+ elif getent hosts "$LHOST.org" >/dev/null; then
+ LHOST="$LHOST.org"
+ elif getent hosts "$LHOST.com" >/dev/null; then
LHOST="$LHOST.com"
fi
# TODO what to do when we can't expand it?