- Difficulty: Expert
- Application: Perl
Save this as a script called tl, and save it to your ~/bin directory:
#!/usr/bin/perl -w use strict; $|++; my $host=`/bin/hostname`; chomp $host; while(1) { open(LOAD,"/proc/loadavg") || die "Couldn't open /proc/loadavg: $!\n"; my @load=split(/ /,<LOAD>); close(LOAD); print "$host: $load[0] $load[1] $load[2] at ", scalar(localtime); print "\007"; sleep 2; }When you'd like to have your titlebar replaced with the name, load average, and current time of the machine you're logged into, just run tl&. It will happily go on running in the background, even if you're running an interactive program like Vim.
No comments:
Post a Comment