home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Hack-Phreak Scene Programs
/
cleanhpvac.zip
/
cleanhpvac
/
SATAN11.ZIP
/
PERL
/
HOSTNAME.PL
< prev
next >
Wrap
Perl Script
|
1995-04-11
|
561b
|
24 lines
#
# file: hostname.pl
# usage: $hostname = &'hostname;
#
# purpose: get hostname -- try method until we get an answer
# or return "Amnesiac!"
#
package hostname;
sub main'hostname {
if (!defined $hostname) {
$hostname = ( -x '/bin/hostname' && `/bin/hostname` )
|| ( -x '/usr/ucb/hostname' && `/usr/ucb/hostname` )
|| ( -x '/bin/uname' && `/bin/uname -n` )
|| ( -x '/usr/bin/uuname' && `/usr/bin/uuname -l`)
|| 'Amnesiac! '; # trailing space is for chop
chop $hostname;
}
$hostname;
}
1;