Return to BSD News archive
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!bunyip.cc.uq.oz.au!munnari.oz.au!constellation!bubba.ucc.okstate.edu!news.ksu.ksu.edu!vixen.cso.uiuc.edu!howland.reston.ans.net!pipex!uunet!dziuxsolim.rutgers.edu!caip.rutgers.edu!not-for-mail
From: halasz@kewszeg.UUCP
Newsgroups: comp.unix.bsd
Subject: Re: TERM type on login?
Date: 23 Jan 1995 20:14:37 -0500
Organization: caip
Lines: 85
Sender: halasz@caip.rutgers.edu
Distribution: world
Message-ID: <3g1k9t$aka@caip.rutgers.edu>
References: <D2CpqG.JHq@world.std.com> <3ek72l$dk8$1@mhadg.production.compuserve.com>
NNTP-Posting-Host: caip.rutgers.edu
Brent (71154.1734@CompuServe.COM) wrote:
: If I make my user's shell an application (specifically a BBS
: program) how can I set the TERM type when they login. When my
: dialup lines connect the tty is unknown and the PINE mailer
: refuses to run as does lynx. Can someone help me out here?
: Brent
from kseel@world.std.com (kurt w seel):
*I use this in my /etc/profile ;
*
*#
*# Get the last term (in .term)
*#
*T=`cat $HOME/.term`
*
*#
*# Confirm it
*#
*error=1
*while [ $error != 0 ]
*do
* echo -n "Enter Terminal Type (default = $T)"
* read a
* TERM=${a:-"$T"}
*
* tput -T $TERM 2> /dev/null
* error=$?
*
* if [ $error != 0 ]
* then
* echo "No, that's not a terminal , try again ... "
* fi
*done
On my Unix, this has problems, for the "tput"-line exits with 2, no command.
This is eazilie solvd:
tput -T $TERM longname
this is nice, for it shows the chozen name. Furthermore, this is not
good shell-programming style. This is better:
#
# Get the last term (in .term)
#
T=`cat $HOME/.term`
#
# Confirm it
#
until echo -n "Enter Terminal Type (default = $T)"
read a
TERM=${a:-"$T"}
tput -T $TERM longname
do
echo "No, that's not a terminal , try again ... "
done
Nonetheless, why all this hacking? You hav no "tset"? It was made for this.
Look:
#
# Get the last term (in .term)
#
T=`cat $HOME/.term`
#
# Confirm it
#
until eval `tset -m ":?$T" -r -s`
do :
done
With flag "-s" "tset" outputs commands that set and export "TERM". If your
"tset" loops until a good terminal-name is enterd, the loop is not needed:
#
# Get the last term (in .term)
#
T=`cat $HOME/.term`
#
# Confirm it
#
eval `tset -m ":?$T" -r -s`