Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I discovered through this answer that I've been setting terminal colours in my prompt in a naive way for years.

I've now modified my .bashrc to use 'tput' commands to colourise various elements of my prompt. The one remaining escape code I have is this:

TITLEBAR="\[\033]2; PROD - \u@\h:\w \007\]"

Does anyone know if there is a tput/terminfo attribute I can use to set the title bar of my terminal window, so that I can eliminate that escape?

share|improve this question
add comment

4 Answers 4

up vote 2 down vote accepted

The actual capabilities are tsl (To Status Line) and fsl (From Status Line), but of course not all terminals have then. In Linux in particular you need to set your terminal to xterm+sl or something similar.

You can test this with

export TERM=xterm+sl
echo `tput tsl` Hello world `tput fsl`; sleep 10

I wouldn't bother and keep those escapes in .bashrc

share|improve this answer
    
Seems my copy of Ubuntu lacks that terminal info. :( I blame incomplete terminfo files :) –  David Pashley Jun 11 '09 at 12:16
    
screen, however, appaears to support them just fine. Thanks! –  Murali Suriar Jun 11 '09 at 12:26
add comment

Having looked at the xterm terminfo file, I can't find any code that is identical to this command, so I suspect there is not.

If you're interested, the terminfo man page lists all the commands that termcap and terminfo understand. I decompiled the terminfo database file using:

# infocmp -L xterm 
share|improve this answer
add comment

I can't comment, thus an extra answer:

If you use tsl/fsl, be sure to ask the terminal for hs first. hs should be true if tsl/fsl (and other *sl) are supported.

tput hs && { echo ....; }
share|improve this answer
    
+1 if you have a reference for this. –  l0b0 Mar 21 '12 at 8:28
add comment

For more info on xterm's "vt100 mode" special features, see the Xterm Control Sequences document in the Operating System Controls section for all the gory details.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.