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?
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
I wouldn't bother and keep those escapes in .bashrc
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.
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:
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.