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
0 comments