Reattach

Until they add mosh support to my favorite terminal emulator, I use a little shell script named  reattach  in /usr/local/bin/

#!/bin/bash

SCREENID=`screen -ls | fgrep Detached | sed 's/s*([0-9]*).*/1/' | head -n 1`
if [ "$SCREENID" = "" ]; then
	echo "we have no moar screeensss!!";
else
	screen -r $SCREENID
fi

So when my PC or laptop come out of sleep/standby (I hate turning things off but I try to be green.. so sleep it is.) and xShell reconnects to a bunch of servers, I let the above script grab the first free screen session and reattach it in every tab.

A second saved is worth two in the bush. Or something like that.

Leave a Reply

Your email address will not be published.