Pages

Wednesday, August 29, 2007

Set Term Title

On MacOSX, the bundled Terminal app won't change the window title as you ssh/telnet, which becomes an issue if you are telnetting to several servers. Of course you could use the prompt to differentiate the connections, but I generally prefer smaller prompts.

To work around, add this to your remote .bashrc

if [ -n "$PS1" ]; then
echo -n -e "\033]0;`hostname`\007"
fi

The PS1 check is just to ensure that in non-interactive sessions (such as the one started by rsync), the echo doesn't corrupts the stream.