Sponsored Content
Full Discussion: I need help with...<various>
Top Forums Shell Programming and Scripting I need help with...<various> Post 302228190 by era on Saturday 23rd of August 2008 10:54:35 AM
Old 08-23-2008
There are different versions of host so that might be the explanation. The idea is workable, though; get the verbose (debugging) output and parse out the fields you want. But in any case, to get the name and IP address of the name servers, you will need multiple queries -- one to get the names of the name servers, and another to look up their IP addresses. (Some sites put raw IP addresses in the NS records but this is strongly discouraged.)

I think Ikon misunderstood your question, perhaps because the output format you are suggesting is somewhat misleading (perhaps it should mention that these are the IP addresses of the name servers). The pipeline could be simplified a bit but the request of A records instead of NS records is wrong anyway.

Here's what my version of host prints:

Code:
vnix$ host -t ns example.com
example.com             NS      a.iana-servers.net
example.com             NS      b.iana-servers.net

So by taking the third field from that and querying for its address, we get the name server IP addresses:

Code:
host -t ns example.com | while read dom ns server; do host -t a $server; done

Dressing it up into the format you want is left as an exercise; it can be done along the same lines.

PS. Please try to think up a helpful thread topic title next time.

Last edited by era; 08-23-2008 at 12:00 PM..
 
platform::shell(n)					       Tcl Bundled Packages						platform::shell(n)

__________________________________________________________________________________________________________________________________________________

NAME
platform::shell - System identification support code and utilities SYNOPSIS
package require platform::shell ?1.1.4? platform::shell::generic shell platform::shell::identify shell platform::shell::platform shell _________________________________________________________________ DESCRIPTION
The platform::shell package provides several utility commands useful for the identification of the architecture of a specific Tcl shell. This package allows the identification of the architecture of a specific Tcl shell different from the shell running the package. The only requirement is that the other shell (identified by its path), is actually executable on the current machine. While for most platform this means that the architecture of the interrogated shell is identical to the architecture of the running shell this is not generally true. A counter example are all platforms which have 32 and 64 bit variants and where a 64bit system is able to run 32bit code. For these running and interrogated shell may have different 32/64 bit settings and thus different identifiers. For applications like a code repository it is important to identify the architecture of the shell which will actually run the installed packages, versus the architecture of the shell running the repository software. COMMANDS
platform::shell::identify shell This command does the same identification as platform::identify, for the specified Tcl shell, in contrast to the running shell. platform::shell::generic shell This command does the same identification as platform::generic, for the specified Tcl shell, in contrast to the running shell. platform::shell::platform shell This command returns the contents of tcl_platform(platform) for the specified Tcl shell. KEYWORDS
operating system, cpu architecture, platform, architecture platform::shell 1.1.4 platform::shell(n)
All times are GMT -4. The time now is 11:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy