Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!husc6!bloom-beacon!think!ames!ptsfa!ihnp4!ihlpa!kai From: kai@ihlpa.ATT.COM (Irwin) Newsgroups: comp.unix.wizards Subject: Re: System wide .login Message-ID: <4668@ihlpa.ATT.COM> Date: Fri, 17-Jul-87 21:09:59 EDT Article-I.D.: ihlpa.4668 Posted: Fri Jul 17 21:09:59 1987 Date-Received: Sat, 18-Jul-87 18:35:29 EDT References: <2626@sdsu.UUCP> <142700009@tiger.UUCP> Organization: AT&T Bell Laboratories - Naperville, Illinois Lines: 71 Summary: I used to use a terminal "MAP" file In article <142700009@tiger.UUCP>, rjd@tiger.UUCP writes: > > > I've tried to set up a shell script in the systems /etc/profile > > to read user input and set the terminal type accordingly, but I ran into > > a problem with the TERM variable being exported to the login shell and > > not to the users shell. A system wide .login might run into similar > > 'environment' problems. I'm running System V (ver 3.0) on a 3B2-400. > > An ATT technician tells me there is a way to fix this. Any ideas > > on this or the system wide .login?? > > > > Andy Wing > > The users login shell and users shell are the same shell. All you need to > do is to remember to export the enviroment variable, e.g.: > ---from a sample /etc/profile:----------- > /bin/echo "Enter terminal type: \c" > read TERM > export TERM > ----------------------------------------- > simple, huh? > > Randy Davis UUCP:(ihnp4!)3b2fst!randy I used to use a little shell script called "termlo" that I wrote that would look up hardwired terminal types in a "MAP" and only prompt for a terminal if it was a dial up port ( actually it would "best guess" the default for dial-ups too.) the "MAP" looked somthing like: /dev/console::4425:system console:computer center /dev/tty001::vt100:user terminal:room 514 /dev/tty010:bob:vt100:dial-up:bobs PC /dev/tty010:bobo:wyse30:dial-up:bobos desk ...etc so console would always be an AT&T 4425, tty001 always a vt100, dialups based on the user id so in /etc/profile: export TERM TTY=`tty` TERMLO=`grep $TTY /etc/termmap | cut -d: -f1-3` USER=`echo "$TERMLO" | grep $LOGNAME | cut -d: -f2` TERM=`echo "$TERMLO" | grep "$TTY:$USER:" | cut -d: -f3` if test -n "$USER" then echo "Enter Terminal Type [Default $TERM]:\c" read term TERM=${term:-$TERM} fi and in a shell script called termlo: echo "TTY\t\tUSER\t\tUSE\t\tDESCRIPTION" echo sed 's/://g' < /etc/termmap I'm trying to do this by memory so i won't promise this will work with out some debugging but it worked very well and in the invironment it was used it generated correct defaults MOST of the time, and the "termlo" command gave a pretty good indication as to where the login was comming from (termlo was more elaberate than I show but I don't have the script handy) Ken A. Irwin AT&T Bell Labs, Naperville IHP 1a332 (312) 416-4485