User Tools

Site Tools


convert

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

convert [2006/07/25 21:22] (current)
Line 1: Line 1:
 +# $EPIC: convert.txt,​v 1.2 2006/07/24 07:11:25 sthalik Exp $
 +======Synopsis:​======
 +$convert(<​ip address|hostname>​)
 +
 +======Technical:​======
 +This function does a DNS lookup on the given address. ​ For an IP address,
 +it attempts to find the corresponding Internet hostname. ​ For a hostname,
 +it attempts to find the corresponding IP address.
 +
 +======Practical:​======
 +This function does effectively the same thing as $[[iptoname]]() and
 +$[[nametoip]](). ​ It is mostly useful when you want to convert an address, but
 +you aren't sure if the input will be an IP address or not.
 +
 +======Returns:​======
 +IP address or hostname corresponding to input, or nothing on error
 +
 +======Examples:​======
 +<​file>​
 +$convert(some.school.edu) ​      ​returns IP address for "​some.school.edu"​
 +$convert(192.168.1.1) ​          ​returns hostname for "​192.168.1.1"​
 +</​file>​
 +
 +An easy example of this in a script is:
 +
 +<​file>​
 +alias dns {
 +  echo Matched $0 to $convert($0)
 +}
 +</​file>​
  
convert.txt ยท Last modified: 2006/07/25 21:22 (external edit)