SshAlwaysScreen
Note: You are viewing an old revision of this page. View the current version.
# always use screen on remote hosts if possible
ssh ()
{
if [ x$1 = x ]
then
# ssh doesn't make sense without arguments
echo "must supply hostname" >%2
elif [ x"$2" = "x" ]
then
# only hostname specified, try to ssh and launch screen
if ! /usr/bin/ssh -t $1 screen -A -D -RR
then
# if attempt to launch screen failed, fall back to regular
# ssh
/usr/bin/ssh $@
fi
else
# if user passes more than one arg, it's something to execute
# on remote host, and thus we don't want to launch remote
# screen.
/usr/bin/ssh $@
fi
}

