1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-22 16:20:23 +02:00

Baptiste Daroussin: 27271: remove awk dependence

This commit is contained in:
Peter Stephenson 2009-09-13 18:26:21 +00:00
parent d980a79a43
commit 1f6225fd78
2 changed files with 7 additions and 5 deletions

View file

@ -23,12 +23,11 @@ if [[ -z $EMAIL_ADDR ]]; then
host=$HOST
elif [[ -f /etc/resolv.conf ]]; then
# Next, maybe we've got resolv.conf.
domain=$(awk '/domain/ { print $2 }' /etc/resolv.conf)
domain=${${=${(M)${(f)"$(</etc/resolv.conf)"}:#domain*}}[2]}
[[ -n $domain ]] && host=$HOST.$domain
fi
# Next, maybe we've got nlsookup. May not work on LINUX.
[[ -z $host ]] && host=$(nslookup $HOST 2>/dev/null |
awk '/Name:/ { print $2 }')
# Next, maybe we've got nslookup. May not work on LINUX.
[[ -z $host ]] && host=${${=${(M)${(f)"$(nslookup $HOST 2>/dev/null)"}:#Name:*}}[2]}
if [[ -z $host ]]; then
# we're running out of ideas, but this should work.
# after all, i wrote it...