Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Re: Another use of this useful escape sequence' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Re: Another use of this useful escape sequence
Authored by: Paul Burney on Feb 07, '02 08:16:07PM

That's a great idea. Here's how I'm implementing it:

#!/bin/sh
if [ $# != 1 ]
then
title='Burney Terminal';
else
title="$1";
fi
echo -n "^[]0;$title^G"

The same rules as above apply for creating the control characters ^[ and ^G as in the above postings. I've saved this file in my path as "settermname" so I can just call settermname with an argument to change the title to the argument. If no argument is specified, it defaults to my default.

I now use this for my other aliases, like this:

alias sshweb "echo 'Connecting to burney.ws via SSH...'; settermname 'SSH -> burney.ws'; ssh burney.ws; settermname;"

When I exit the other server, the terminal is set back to the default name.

Note, this simple script works in the default TCSH shell. I don't know about others. YMMV.



[ Reply to This | # ]