bash screen auto reattach
automatically search for an attached screen session at login and reattach
cb0@home:~/$cat >> ~/.bashrc << EOF
if [ \$SSH_TTY ] && [ ! \$WINDOW ]; then #comment out for local usage
SCREENLIST=\`screen -ls | grep 'Att'\`
if (( ! \$? )); then
echo -e "Screen running and attached:\n \${SCREENLIST}"
else
screen -U -R
fi
fi #comment out for local usage
EOF
[:edit:]
The script above only works when you connect through ssh. If you login from a real terminal $SSH_TTY and $WINDOW won't be set.
Comment out lines marked for local usage if like screen as much as i do.