#!/bin/sh # Author: Lubomir Host 'rajo' # $Platon: xssh.sh,v 1.1 2002/07/31 09:57:47 rajo Exp $ # Use this script to connect to remote host # if you will running X aplications on this host if [ "$#" -lt 1 ]; then cat < $0 -l EOF exit fi if [ ! "$?DISPLAY" -o -z "$DISPLAY" ]; then echo "DISPLAY isn't set, can't connect with $0"; exit 1; fi # # Export ~/.Xauthority file to remote host # echo "Running xauth..." #xauth extract - $DISPLAY | ssh $* xauth merge - #ssh $* xauth add `xauth list |grep -v unix` XAUTH_HOST_IP=`hostname -i | awk '// { print $1 }'` DISP=`xauth list $DISPLAY | awk "{print \"$XAUTH_HOST_IP:0 \" \\$2 \" \" \\$3}"` if [ -z "$DISP" ]; then echo "Somethings is wrong in your DISPLAY enviroment or ~/.Xauthority file"; echo "Can't connect with $0"; exit 1; fi ssh $* "xauth add $DISP && echo \"DISPLAYS on remote site:\" && xauth list" if [ "$?" -ne 0 ]; then echo "$0: Can't export \$DISPLAY to remote host, exiting ..." exit 1 fi # # Connect with ssh # echo "Connecting with ssh..." ssh $* # Modeline for ViM {{{ # vim:set ts=4: # vim600:fdm=marker fdl=0 fdc=3: # }}}