Can I pass variables to rlogin?

James Cameron jc at condor.bu.edu
Tue Apr 16 12:13:40 AEST 1991


>>>>> On 14 Apr 91 23:10:50 GMT, umh at 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 at 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.)



More information about the Comp.unix.questions mailing list