Tuesday, May 02, 2006

Quickie screen tip: always running screen

It's easy to set screen up so it automatically resumes your last session as soon as you log in. If you don't like to manually type 'screen -<args>' after logging in, and you don't like screen sessions getting stranded by a killed terminal, try the following in your shell's user rc/profile:

if ! echo $STY | cut -d. -f1 | xargs ps -p 2> /dev/null | grep -i screen; then
exec screen -RR
fi


Credit to danieldg on Freenode IRC for this approach.