Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!sdd.hp.com!zaphod.mps.ohio-state.edu!ub!uhura.cc.rochester.edu!rochester!kodak!ispd-newsserver!garden!weimer From: weimer@garden.kodak.COM (Gary Weimer (588-0953)) Newsgroups: comp.unix.questions Subject: Re: Want to load a different .exrc file depeneding on the TERM Keywords: vi, shell, TERM, setenv Message-ID: <1991Jan24.210535.20490@ssd.kodak.com> Date: 24 Jan 91 21:05:35 GMT References: <1991Jan22.224538.9351@cs.uiuc.edu> Sender: news@ssd.kodak.com Reply-To: weimer@ssd.kodak.com Organization: Eastman Kodak Co.; Rochester, NY Lines: 40 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