backup terminal title

Warren Block wblock at
Sun Feb 7 03:58:17 UTC 2010

On Sat, 6 Feb 2010, perryh at wrote:

>> I wish to use  the "\033]0;%s\007" sequence in a shell-script to
>> set the title of a terminal. But only if I am able to undo it.
>> My requirement is that this must be done without using anything
>> outside the base system.
> There is an escape sequence which will cause the terminal to echo
> back its current title, but it's a bit tricky to use given only
> base-system tools because the echo ends with, IIRC, \007 rather
> than \n.  It may be possible in some shells to temporarily set the
> line-end character to \007.  You probably also want to (somehow)
> cover problematic cases like terminals that don't reply to the
> inquiry even though TERMCAP implies that they should.

% printf "\033]0;Title Here\007"

What's the sequence for reading the terminal title?

-Warren Block * Rapid City, South Dakota USA

More information about the freebsd-questions mailing list