Subject: use of $REMOTEHOST and xterm (was odd behavior of pipe command)

From: Mike Miller <[email-masked]>
Date: Sat, 12 Sep 1998 23:09:00 -0500 (CDT)

In my last message I suggested that instead of using
who am i | awk '{print $6}' | tr -d '()'
or equivalently on my system
who -m | awk '{print $6}' | tr -d '()'
to get the name of the remote host one could use the $REMOTEHOST
environment variable.  That might be specific to the tcsh shell I'm using.
It was compiled with the 'rh' option so that it attempts to set the
$REMOTEHOST environment variable.  So it probably won't work for a lot of
people.

I run Pine on a Sun (Solaris 2.6).  I access it either by telnet from a
PC, using Hummingbird Exceed X-server software (xterm) on a PC
(http://www.hummingbird.com/products/exceed/), OpenWindows on several
Suns, and sometimes VNC (http://www.orl.co.uk/vnc/).  Despite this variety
of methods of logging on, for me, something like this in the .cshrc seems
to always work...    (but I would very much appreciate suggestions for
                      improvements)

if ( $?prompt ) then

   if ( $?REMOTEHOST ) then
      set display=$REMOTEHOST\:0.0
   endif

   if ( $?DISPLAY ) then
      set display=$DISPLAY
   endif

   set savehist=500
   set history=500
   set prompt="`whoami`@`hostname`:\!> "

   echo " "
   echo "My best guess at your address and display is $display"
   echo "If this is wrong, X-server aliases will not work for you during this"
   echo "session until you change disp using the set command.  If a program gives" | sed 's/disp/$display/g'
   echo "you an error, precede the program name with a '\' as in \pico or \pine"
   echo "or \telnet.  If you have questions, contact Mike Miller at 882-5671 or"
   echo "by e-mail to [email-masked]."
   echo " "

endif

#  Aliases for apps that can use X or not (nw = no window)

alias emacs         'emacs -cr red -display $display \!* &'
alias emacsnw       '\emacs -nw -cr red \!*'
alias pico          'xterm -n Pico -T Pico -e pico -bdegjmw -r74 \!* &'
alias piconw        '\pico -bdegjmwz -r74 \!*'
alias pine          'xterm -n Pine -T Pine -e pine -z -feature-list=use-subshell-for-suspend \!* &'
alias pinenw        '\pine -z -feature-list=no-use-subshell-for-suspend \!*'
alias pilot         'xterm -n Pilot -T Pilot -e pilot -agjm $PWD &'
alias pilotnw       '\pilot -agjmz $PWD'
alias telnet        'xterm -n \!* -T \!* -e telnet \!* &'
alias telnetnw      '\telnet \!*'
alias xemacs        'xemacs -cr red -display $display \!* &'
alias xemacsnw      '\xemacs -nw \!*'

#  Aliases that require X

alias xterm         'xterm -cr red -j +sb -display $display \!* &'
alias cmdtool       'cmdtool +Wi -display $display \!* &'
alias shelltool     'shelltool +Wi -display $display \!* &'
alias cm            'cm +Wi -display $display \!* &'
alias filemgr       'filemgr +Wi -display $display -d $PWD \!* &'
alias gv            'xterm -n GhostView -T GhostView -e ghostview \!* &'
alias imagetool     'imagetool +Wi -display $display \!* &'
alias sas           'sas +Wi -display $display \!* &'

-----------------------------------------------------------------
 For information about this mailing list, and its archives, see: 
 http://www.washington.edu/pine/pine-info/
-----------------------------------------------------------------