views:

118

answers:

1

Is there a way to automatically have each window change its name to the name of the last program you ran from that window?

This would be more convenient than having to rename the windows manually.

+2  A: 

Yes, you can use shelltitle to do this.

Assuming you use bash, the following should work. Add this to your .screenrc:

shelltitle "$ |bash"

where the "$ " should match whatever is at the end of your prompt string ($PS1) and "bash" is the default title. Then add a null title escape sequence to the beginning of your prompt string:

export PS1='\[\033k\033\\\]'$PS1

which should go in your .profile or whatever.

ezod
I guess other shells (tcsh, zsh) let you hook something to be run after you type a command; this would probably be a more sensible place to put the escape sequence if you use one of those.
ezod
Thanks. This works.
dan