Want to load a different .exrc file depeneding on the TERM

Gary Weimer 588-0953 weimer at garden.kodak.COM
Fri Jan 25 08:05:35 AEST 1991


In article <1991Jan22.224538.9351 at cs.uiuc.edu>, joshi at cs.uiuc.edu (Anil
Joshi) writes:
|> I have to do the following.
|> 
|> I login to my UNIX host from two types of terminals
|> 
|> op4x (which is Esprit Opus or some such junk)
|> and 
|> some sun workstation (I do not know the exact model etc.)
|> 
|> Now what I want to do is to redefine the keys in .exrc so that all
the function
|> keys, arrow keys and other keys work as they are labelled (which
usually do not work ... without map).
|> 
|> What I want to know is how can I get the shell variable TERM. 
|> 
|> When I login from Esprit, the variable has a value of "op4x" and on the 
|> sun it has "sun". I would like to extract this in .cshrc and copy the 
|> appropriate file to .exrc
|> 
|> Can somebody give me a simple shell (csh) script (code fragment will do) to 
|> exatract this stuff?

The trouble with copying files is that you can not use both terminals--
maybe not a problem for you. In SunOS, vi checks for the environment
variable EXINIT, so you could do the following:

if ("$term" == "op4x) setenv EXINIT ":so ~/.exrc.op4x"
if ("$term" == "sun") setenv EXINIT ":so ~/.exrc.sun"

($term == $TERM in SunOS csh)

Contrary to the 'man vi' ~/.exrc cannot exist if you want to use the
EXINIT environment variable.

If you have generic stuff to use for both terms, add ':so ~/.exrc.gen'
to the bottom of each of the above init files and put the generic stuff
in ~/.exrc.gen



More information about the Comp.unix.questions mailing list