Misc: Xterm titles

Title:

Misc: Xterm titles

Author:

Douglas O’Leary <dkoleary@olearycomputers.com>

Description:

Misc: Xterm titles

Date created:

02/2001

Date updated:

03/2002

Disclaimer:

Standard: Use the information that follows at your own risk. If you screw up a system, don’t blame it on me…

To update the title bar of an xterm whenever you cd into another directory, enter the following into your ~/.kshrc file:

mcd()
{
   Me=$(whoami)
   Host=$(hostname)
   cd $*
   Pwd=$(pwd)
    echo "<ctrl>-v<ESC>]0;${Me}@${Host}:${Pwd}<ctrl>-v<ctrl>-g\c"
}

alias cd="mcd"

Two minor points:

  • The normal cd<enter> won’t work anymore; enter cd ~

  • This function will lock up dtterms. It’ll log in with hpterms (just won’t update the title); however, you’ll never see a prompt if you’re using dtterms. Use this function if you want to use Xterms only!