Peder Stray
Tue, 19 Sep 2006 09:44:49 -0700
On Tue, 19 Sep 2006, Michael Parson wrote:
On Tue, Sep 19, 2006 at 05:27:51PM +0200, Xavier Nicollet wrote:Le 19 septembre 2006 ? 09:59, Peter a ?crit:I want to have screen launched when I log in to a Linux system with SSH. I have put the screen command inside ~/.bashrc. The result is that screen will reread .bashrc and sets up a loop which keeps starting screen over and over. My .screenrc file automatically starts 3 windows. How do I prevent this loop?I read somewhere that it is not advised to do that.One of the features of screen is that you can disconnect from screen and log out, log back in later and reconnect to the existing session. Having it auto-start a new screen every time you log in could make that difficult. If you want to start screen faster than having to type out 'screen' (or 'screen -r') after you log in, then learn to use the history features of the bash shell. When I log in, I hit ^R, then start typing screen, I usually don't have to get farther than about sc before it has found the match and I just hit return and I'm off.
Remember that screen adds $STY to your environment, so you can test for it:
if [ -z "$STY" ]; then
exec screen -dR
fi
which would exec screen, attach to an already running or start a new
screen if you aren't already in one. No problem there...
Of course, you wouldn't want to do this on a host you start xterms on i guess, since all of them would attach to the same screen, effectively detatching the other ones. But for a host you ssh into, it would be ok.
-- Peder Stray _______________________________________________ screen-users mailing list screen-users@gnu.org http://lists.gnu.org/mailman/listinfo/screen-users