#!/bin/sh
if [ "$1" == "" ]; then
	screen -ls
	exit 1;
fi;
tmpfile=/tmp/screen.dump.$RANDOM
res=`screen -x -r -S $1 -X hardcopy -h $tmpfile`
if [ "$res" != "" ]; then
	echo "Error fetching screen";
	exit 1;
fi;

sleep 1s
cat $tmpfile
rm $tmpfile
