Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!rpi!bu.edu!nntp-read!jc From: jc@condor.bu.edu (James Cameron) Newsgroups: comp.unix.questions Subject: Re: Can I pass variables to rlogin? Message-ID: Date: 16 Apr 91 02:13:40 GMT References: <1991Apr14.191051.4037@vax5.cit.cornell.edu> Sender: news@bu.edu.bu.edu Distribution: comp Organization: What do you mean I *can't* do that???? Lines: 74 In-reply-to: umh@vax5.cit.cornell.edu's message of 14 Apr 91 23:10:50 GMT >>>>> On 14 Apr 91 23:10:50 GMT, umh@vax5.cit.cornell.edu said: [...deleted lines concerning how to work on several computers in X windows...] umh> Or am I barking up the wrong tree? Is this nicely fixed by some X magic, not umh> using UNIX at all? umh> If anyone has been able to do something like this, please tell me. I'll umh> summarize any methods I find, of general interest. umh> Maynard Handley The solution I use is the script which follows; I did not write it and I am unsure of who did, but there are many similiar to this one out there. This should completely solve your problem. ---xshell--- #!/bin/csh -f # # this sets up an xterm on the remote machine at the same time # performing a xhost for the remote machine on the display machine # # First, find the name of the display # set command=$0 if ( $#argv == 0 ) then echo Usage: $command:t hostname exit 1 endif set remotehost=$1 shift set displayhost=`printenv DISPLAY | sed -e 's/:.*//'` # # Now we need to see if this has the right name # switch ( $displayhost ) case unix: # display on the local host xhost $remotehost if ( $status != 0 ) then echo xhost failed on local machine exit 1 endif set displayhost=`hostname` breaksw case "": # not an X device echo The environment variable DISPLAY is not echo set. You must issue the command \"$command:t\" echo from an X device. exit 1 breaksw default: # display on a remote host echo "setenv DISPLAY ${displayhost}:0.0 ; xhost $remotehost" | rsh $displayhost csh -t if ( $status != 0 ) then echo xhost failed on machine \"$displayhost\". exit 1 endif breaksw endsw rsh $remotehost xterm -display ${displayhost}:0.0 -ls -n $remotehost $argv & exit 0 -- -- James Cameron (jc@raven.bu.edu) Signal Processing and Interpretation Lab. Boston, Mass (617) 353-2879 ------------------------------------------------------------------------------ "But to risk we must, for the greatest hazard in life is to risk nothing. For the man or woman who risks nothing, has nothing, does nothing, is nothing." (Quote from the eulogy for the late Christa McAuliffe.)