Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!ut-sally!husc6!think!ames!sdcsvax!ucsdhub!jack!man!nu3b2!rwhite
From: rwhite@nu3b2.UUCP (Robert C. White Jr.)
Newsgroups: comp.unix.wizards
Subject: Re: system wide .login
Message-ID: <786@nu3b2.UUCP>
Date: Tue, 7-Jul-87 03:23:17 EDT
Article-I.D.: nu3b2.786
Posted: Tue Jul  7 03:23:17 1987
Date-Received: Sat, 11-Jul-87 05:46:12 EDT
References: <8176@brl-adm.ARPA>
Organization: National University, San Diego
Lines: 70
Summary: our 3B2/310 Profile [long and nearily standard]

In article <8176@brl-adm.ARPA>, V2002A%TEMPLEVM.BITNET@wiscvm.wisc.EDU 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  

this is our /etc/profile, it does the TERM bit. [If you use a table
replace the "read"s with "awk"s against your table.  The added code is
in there twice, but it only runs once per invocation [either by login
exec(ing) sh with the -sh name or su -.


#	@(#)profile	1.5	/sccs/src/cmd/sadmin/etc/s.profile
#	The profile that all logins get before using their own .profile.

trap ""  2 3
export LOGNAME

. /etc/TIMEZONE

#	Login and -su shells get /etc/profile services.
#	-rsh is given its environment in its .profile.
case "$0" in
-su )
	export PATH
	stty ixon -ixany
# <<<<<  ADDED HERE  >>>>>>>>>
	stty erase "^H" echoe
	echo "Enter Terminal Type (default = 610): \c"
	read TERM
	echo "Terminal Type Set to: ${TERM:=610}"
	export TERM
# <<<<<   To HERE    >>>>>>>>
	;;
-sh )
	export PATH
	stty ixon -ixany
# <<<<<< and AGAIN   >>>>>>>>>
	stty erase "^H" echoe
	echo "Enter Terminal Type (default = 610): \c"
	read TERM
	echo "Terminal Type Set to: ${TERM:=610}"
	export TERM
# <<<<<   To HERE    >>>>>>>>

	#	Allow the user to break the Message-Of-The-Day only.
	trap "trap '' 2"  2
	cat -s /etc/motd
	trap "" 2

	if mail -e
	then
		echo "you have mail"
	fi

	if [ ${LOGNAME} != root ]
	then
		news -n
	fi
	;;
esac

umask 022
trap  2 3