Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am running screen inside Mac OSX Terminal app (bash).

Here is the screenrc (got it from here):

$ cat ~/.screenrc 
termcapinfo xterm* ti@:te@
startup_message off
defutf8 on
shelltitle "$ |what?" # make screen assign window titles automatically
hardstatus alwayslastline
hardstatus string '%{= kw} [ %{= kb}%H%{= kw} ][%= %{= kw}%?%-Lw?%{= kW}%n*%f %t%?%?%{= kw}%?%+Lw%?%?%= ][ %{r}%l%{w} ]%{w}[%{r} %m/%d/%y/ %C %A %{w}]%{w}'
$

As can be seen I do have the line to show the current process name as the title in screen:

shelltitle "$ |what?" # make screen assign window titles automatically

But inside screen I just see "what?" (the default) instead of the process-name. Which suggests that "$" is not working.

What am I missing? And how does the "$ |something-else" work?

share|improve this question

migrated from stackoverflow.com Sep 26 '11 at 6:43

This question came from our site for professional and enthusiast programmers.

1 Answer 1

What is your bash prompt set to (i.e. the PS1 variable)?

Try the following in your .bashrc or .profile:

export PS1='\[\033k\033\\\]\u@\h:\w\$ '

and in your .screenrc:

shelltitle "$ |bash:"

This is what I have and it works. Basically, screen needs a magic string to know how your prompt ends so it can pick up the command that's running. You can vary it, but see the explanation on this page for more information on how it works:

share|improve this answer
    
sorry for the late reply - was AWOL. I read up and got that screen needs a magic string (unless in zsh etc.). However, this solution still does not work. Here's what I have: $ grep PS1 .bashrc export PS1='\[\033k\033\\\]\u@\h:\w\$ ' $ grep bash .screenrc shelltitle "$ |bash:" So now all I see is "bash:" :) –  arnab Aug 19 '09 at 7:21
    
You're supposed to see "bash" while you're at the prompt, because that's the only thing running. If you run "sleep 600", it should change to "sleep" while that's running, inferred from the word you typed. –  Gabe Nov 11 '13 at 22:08

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.