| version 1.3, 2002/03/12 18:33:38 |
version 1.4, 2002/03/15 23:38:12 |
|
|
| # Use this script to connect to remote host |
# Use this script to connect to remote host |
| # if you will running X aplications on this host |
# if you will running X aplications on this host |
| |
|
| # On remote host put these lines to your ~/.tcshrc if you #%# {{{ |
|
| # are using tcsh shell. |
|
| |
|
| ##!/usr/bin/tcsh |
if [ "$#" -lt 1 ]; then |
| # |
|
| ## Set $DISPLAY enviroment if there is a record in ~/.Xauthority file |
|
| ## and user is logged in via ssh |
|
| #if ( $shlvl == 1 ) then |
|
| # unsetenv DISPLAY |
|
| # if ($?SSH_CLIENT) then |
|
| # set DISP=`printenv SSH_CLIENT | awk '{print $1 }'`":0" |
|
| # set count=`xauth list $DISP | wc -l` |
|
| # if ( $count == 1 ) then |
|
| # echo "Setting DISPLAY "`(printenv SSH_CLIENT | awk '{print $1 }')`":0" |
|
| # setenv DISPLAY `printenv SSH_CLIENT | awk '{print $1 }'`:0 |
|
| # endif |
|
| # endif |
|
| #endif |
|
| #%# }}} |
|
| |
|
| ## On remote host put these lines to your ~/.zshrc if you ## {{{ |
|
| ## are using zsh(|bash?) shell. |
|
| # |
|
| ## set $DISPLAY enviroment using $SSH_CLIENT |
|
| #disp() |
|
| #{ |
|
| # local DISP count |
|
| # export DISPLAY= |
|
| # if [ $?SSH_CLIENT ]; then |
|
| # DISP=( `printenv SSH_CLIENT | awk '{print $1 }'`:0 ) |
|
| # count=( `xauth list $DISP | wc -l` ) |
|
| # if [ $count = 1 ]; then |
|
| # if [ $SHLVL != 1 ]; then |
|
| # echo "Setting DISPLAY $DISP" |
|
| # fi |
|
| # export DISPLAY=$DISP |
|
| # fi |
|
| # fi |
|
| #} |
|
| ## }}} |
|
| # |
|
| ## If login shell then set display |
|
| #if [ $SHLVL = 1 ]; then |
|
| # disp |
|
| #fi |
|
| |
|
| |
|
| if [ $# -lt 1 ]; then |
|
| cat <<EOF |
cat <<EOF |
| |
|
| Usage: $0 <ssh arguments> |
Usage: $0 <ssh arguments> |
| Line 74 XAUTH_HOST_IP=`hostname -i | awk 'BEGIN |
|
| Line 28 XAUTH_HOST_IP=`hostname -i | awk 'BEGIN |
|
| DISP=`xauth list $XAUTH_HOST_IP:0 | awk "{print \"$XAUTH_HOST_IP:0 \" \\$2 \" \" \\$3}"` |
DISP=`xauth list $XAUTH_HOST_IP:0 | awk "{print \"$XAUTH_HOST_IP:0 \" \\$2 \" \" \\$3}"` |
| ssh $* xauth add "$DISP" |
ssh $* xauth add "$DISP" |
| |
|
| if [ $? -ne 0 ]; then |
if [ "$?" -ne 0 ]; then |
| echo "$0: Can't export \$DISPLAY to remote host, exiting ..." |
echo "$0: Can't export \$DISPLAY to remote host, exiting ..." |
| exit 1 |
exit 1 |
| fi |
fi |