[comp.unix.questions] Want to load a different .exrc file depeneding on the TERM

joshi@cs.uiuc.edu (Anil Joshi) (01/23/91)

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?

Thanks in advance.

Anil Joshi (joshi@cs.uiuc.edu)
--
"Whatever we wish ourselves to be, we have the power to make ourselves.  If what
we are now has been the result of our own past actions,then it certainly follows
that whatever we wish to be in the future, can be produced by our own present 
actions. how to act." - Vivekananda, Late Nineteenth Century Indian Philosopher

weimer@garden.kodak.COM (Gary Weimer (588-0953)) (01/25/91)

In article <1991Jan22.224538.9351@cs.uiuc.edu>, joshi@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