This is a simple script which will display Host Name and Ip address of your computer under Linux Environments

#!/usr/bin/perl

use LWP::UserAgent;
use Socket;
use Sys::Hostname;

$host = hostname();
$ipAddress = inet_ntoa(scalar gethostbyname($host));
print("Host name is :::: $host \n");
print("Ip Address is ::: $ipAddress \n");


Save this code as any file.sh

chmod +x
go to that directory and run $./file.sh

Posted by JavaBooks on Tuesday, July 21, 2009
categories: , edit post

0 comments

Post a Comment

Visits

Label Cloud

Blog Archive

About Me

Followers