[Bio] / StandaloneTools / retitle_xterm.pl Repository:
ViewVC logotype

View of /StandaloneTools/retitle_xterm.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (download) (as text) (annotate)
Sat Jun 2 12:35:41 2007 UTC (12 years, 4 months ago) by overbeek
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +4 -4 lines
Minor cosmetic changes. -- /gdp

#!/usr/bin/perl -w

if ( defined($term = $ENV{"TERM"}) && ($term !~ /xterm/) )
{
    exit;
}

if (@ARGV)
{
    $title = shift @ARGV;
}
else
{
    if    (defined($name = `whoami`))         { chomp($name); }
    elsif (defined($name = $ENV{"USER"}))     {}
    elsif (defined($name = $ENV{"LOGNAME"}))  {}
    else { $name = "nobody"; }

    if    (defined($host = $ENV{"HOSTNAME"})) {}
    elsif (defined($host = $ENV{"HOST"}))     {}
    elsif (defined($host = `hostname`))       { chomp($host); }
    else { $host = "nowhere"; }
    $host =~ m/^([^\.]+)\.?/;
    $host = $1;

    $title = "$name\@$host";
}

print "\e\]0\;$title\cG";

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3