#! /usr/bin/perl -w # Displays hostname, SSID and IP Address in the Title Bar of a terminal # Based on Linux Server Hacks #59, pp.120 # First written : Paul Schou, Sat Feb 4 13:01:18 EST 2006 # Last modified : Paul Schou/Gowtham, Sat Feb 4 13:01:18 EST 2006 # use strict; $|++; my $host=`/bin/hostname`; chomp $host; while(1) { open(LOAD, "/etc/sysconfig/network-scripts/ifcfg-eth1") || die "Could not open /proc/loadavg: $!\n"; my $comp = "localhost"; while(my $dat = ) { chomp $dat; my @t=split(/=/,$dat); if($t[0] eq "ESSID") { $comp = $t[1]; } } close(LOAD); open(LOAD, "/sbin/ifconfig |") || die "Could not open /sbin/ifconfig: $!\n"; my $ip = ""; while(my $dat = ) { my @t=split(/inet addr:/,$dat); if(@t == 2) { @t=split(/ /,$t[1]); if($t[0] ne "127.0.0.1") { $ip = $t[0]." ".$ip; } } } close(LOAD); print "\033]0;"; print "$host - $comp [ $ip] ", scalar(localtime); print "\007"; sleep 5; }