views:

458

answers:

1

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?

+2  A: 

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:

ars
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