Jump to content

Screen: Difference between revisions

914 bytes added ,  24 February 2010
Added section on reattaching screen automatically
(Added section on reattaching screen automatically)
Line 175: Line 175:


[[Image:screenrc.jpg]]
[[Image:screenrc.jpg]]
=== Reattaching Screen Automatically ===
So, you've made your screen, configured it, and you happily type screen -dr '''every time''' you login to RedBrick. But wouldn't it be nice if whenever you login your screen would reattach '''itself'''??? It can be done :D
Simply use your favorite text editor to edit your ~/.zshrc (or ~/.[name_of_shell]rc) and paste the following code into it.
if [ -z "$STY" -a $TERM != "screen" ]
then
    exec screen -dr
fi
That should do the job. However make sure to keep the spaces between the if statement, the brackets and the inside of the if statement (or it won't work).
In particular
$TERM != "screen"
is very important for that code segment to work, otherwise when connecting to another server (Carbon for instance), your shell will try to attach a screen session, fail and disconnect leaving you on the server you tried to connect from (Really quite annoying).


== Useful links ==
== Useful links ==