Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 235
  • Last Modified:

DNS host-name resolution

Slightly odd one this ......

iIs it possible to configure DNS resolution to return a non-fully qualified host-name????

For example if I enter the following ....

         host <name>

on a unix box, I currently get ...

         <name>.<domain> a.b.c.d

This is fine but I need to just get .....

         <name>  a.b.c.d   (no domain)

Is it possible to achieve this by DNS configuration or do I need to setup some script filtering etc ?????

Many thanks for any help !!!
  • 3
  • 2
1 Solution
No, you need a little script filtering. It's not hard though. My version of host requires the following:


echo -n $1
echo -n " "
host $1 | awk 'END {print $4}'

Save the above in your path somewhere, chmod to make it executable, and then

<name of script> <hostname>

If it doesn't work, post the output of your host command here so I can modify the script.

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

In fact, the script can be made into a one-liner:

echo $1 `host $1 | awk 'END {print $4}'`

=( that's what I was trying to post... =/ ... bad look today.

I use:
# - usage: " <name>"
IPADDR = `host $1 | awk ' {print $2}'`
echo $1 $IPADDR

gets the same result.

rigsbyAuthor Commented:
Your help is very much appreciated !!!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now