Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!ucbvax!ucsfcgl!cca.ucsf.edu!wet!epsilon
From: epsilon@wet.UUCP (Eric P. Scott)
Newsgroups: comp.sys.next
Subject: Reading Mail on another cube
Summary: A starting point for more work?
Message-ID: <422@wet.UUCP>
Date: 16 Aug 89 08:18:56 GMT
Reply-To: epsilon@wet.UUCP (Eric P. Scott)
Organization: Wetware Diversions, San Francisco
Lines: 48

"Is there any way to read my mail on [elsewhere] from this cube
[using the NeXT Mail utility]?"

Now, who was it who said that every problem has an answer that's
simple, obvious, and WRONG?  This is an "rMail" script--you use
it like rlogin, but it provides a remote Mail rather than an
interactive shell.  (more comments follow)

------- cut here -------
#!/bin/csh -f
set noglob
set app=$0
set app=$app:t
if ($app =~ r*) then
	set app=`expr $app : r\\\(.\*\\\)`
	foreach w ($path)
		if (-d $w/${app}.app) then
			set app=$w/${app}.app/$app
			break
		endif
	end
else
	echo "${0}: what am I?"
	exit 1
endif
if ($#argv == 0) then
	echo "Usage: $0 hostname [-l username] [args]"
	exit 1
else
	set remote=$1 ; shift
	if ($1 == -l) then
		set user=$2 ; shift ; shift
		exec /usr/ucb/rsh $remote -l $user -n exec $app -Host \
`hostname` $*:q
	else
		exec /usr/ucb/rsh $remote -n exec $app -Host `hostname` $*:q
	endif
endif
------- cut here -------

You can try linking this to other names, like rTerminal, and see
what happens.  Be careful with rShell--I got nmserver to panic
and die (not sure I can reproduce this).  The check for a .app/
directory really should be done on the remote machine.

Feedback to comp.sys.next.

					-=EPS=-