>If the computer I am working at and the computer that I want to remotely
>logon both run a Unix operating system and xwindows, I have to set DISPLAY
>on the remote machine in order to open a window on my local computer. I am
>interested in that how to get my local computer name and set DISPLAY
>automatically when I logon the remote machine. For security reasons, I could
>not use "x" command. I couldn't use "xrsh" because the remote
>machine doesn't have "xauth". Does anybody know how I can get the local
>computer name and operating system (AIX or SunOS) automatically when I logon
>a remote machine?
>Thanks in advance
>-Bin
I have found a solution to this problem that works wonderfully.
The solution is in 3 parts.
Part 1, I have the following file in my bin dir called rl:
------
#!/bin/sh
if [ -n "$DISPLAY" ]; then
case "$DISPLAY" in
:*)
DISPLAY=`hostname`$DISPLAY
;;
esac
TERM="$TERM&$DISPLAY"
export TERM
fi
xhost +$1 1> /dev/null 2>&1
rlogin $*
cd .
-------------
Part 2, I have the following lines in my .cshrc on ALL that machines I might
log on to. (Even if I don't do it in a window.)
-------------
if ( $?TERM ) then
if ( `echo $TERM | tr -cd '&'` != '' ) then
setenv DISPLAY `echo $TERM | awk "-F&" '{print $2;}' `
setenv TERM `echo $TERM | awk "-F&" '{print $1;}' `
endif
endif
---------------
Part 3, I start up a remote window for whatever machine like this:
---------------
xterm -sl 150 -sb -T Phoenix -e /home/pec2/bin/rl phoenix
--------------
Where Phoenix is the name of the remote machine and pec2 is my uid.
This works GREAT! I can have aliases to pop up remote windows and I have
entries in my menu files so I can use the mouse to pull up a remote window.
Hope this helps.
--
-Paul Carroll
-NSF Engineering Research Center for Computational Field Simulation