Perpetual Screen

by Patrick Connelly posted on December 29, 2008

This article has been updated

So, I’ve been tossing around the idea for the past while to make is so that screen starts up every time I ssh into my box at the house. Well, I finally broke down and did it, and it wasn’t that bad at all. I’ve named my screen session main you can call it whatever you want. Just add the following to the end or your .bashrc If you don’t put it at the end, you the rest of your .bashrc won’t get evaluated.

if [ $TERM == "screen" ]
# If we are already in a screen do nothing
then
  echo -n ""
elif [ $TERM == "dumb" ]
# If we are using scp do nothing
then
  echo -n ""
else
# Startup screen
  screen -Rd main && exit
fi

It works so far with everything I’ve had to do, but we’ll see if I run across any other problems.