Auto reconnect to Screen session

I came across this bit of info which makes life easier. Just add this to your .bash_profile and when you SSH to the server it will auto attach to your screen session if you have one running.

if [[ $TERM != 'screen' ]] ; then
if [[ `screen -list | grep -v "No" | awk ' { print }' | wc -l` == 0 ]] ; then
screen
else
screen -dr
fi
fi