I posted this question on SuperUser but it's hardly getting any views, so I thought I'd ask here as well.

In bash, to display the name of the current program in the GNU Screen hardstatus line takes only two configuration lines. First, tell screen what the end of your prompt normally looks like, and supply a default title for a window when you are sitting at in the shell:

shelltitle "$ |bash"

Next, place this escape sequence in the PS1 variable, before the characters that normally terminate the prompt '$ ' in this case:

\033k\033\\\

This technique works, to a point. The hardstatus window title is updated to the name of the currently running program, and then switches back to the default title shortly after execution is finished. One major problem, however, is that this escape string is not escaped itself, causing line-wrapping problems with commands longer than the initial line.

This was annoying, so I set out looking for a solution. Turns out, simply escaping the previous escape sequence corrects line wrapping:

[\033k]\[\033\\\]

Great! My hardstatus window title still updates to the name of the currently running program, and now my longer commands wrap to the second line correctly. However, with this new escape sequence in my PS1, screen updates the window title to the actual command I am typing, not simply the name of the current program once it is executed.

I am wondering, has anyone gotten this working correctly - i.e. line wrapping and proper updating of the hardstatus window title?

Thanks!

link|improve this question
Please don't cross-post. You have to give people time to get to your question - it's not instantaneous. Your link in this question to the SU question has post in it. Other users can't see that. It needs to be q instead. Voting to close as off-topic. I'll go look at the SU question (I was headed in that direction anyway) and see if I can help. – Dennis Williamson Nov 15 '10 at 17:59
Sorry for cross-posting, I hadn't used SuperUser before asking this question and have always received great answers on ServerFault, so I wasn't really sure where to ask. P.S. link to SuperUser post has been fixed. – johnny_bgoode Nov 21 '10 at 18:04
feedback

1 Answer

Your Answer

 
or
required, but never shown

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