*BSD News Article 76412


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!spool.mu.edu!howland.erols.net!cam-news-hub1.bbnplanet.com!news.mathworks.com!newsfeed.internetmci.com!in3.uu.net!shemesh.hq.tis.com!dira.rv.tis.com!not-for-mail
From: mark@dira.rv.tis.com (Mark Sienkiewicz)
Newsgroups: comp.unix.bsd.bsdi.misc
Subject: Re: TTY specific messages displayed at login?
Date: 19 Aug 1996 14:50:57 -0400
Organization: Trusted Information Systems
Lines: 33
Message-ID: <4vad2h$4r2@dira.rv.tis.com>
References: <4v0598$pku@dfw-ixnews10.ix.netcom.com>
NNTP-Posting-Host: dira.rv.tis.com

In article <4v0598$pku@dfw-ixnews10.ix.netcom.com>,
 <craig@m-net.arbornet.org> wrote:
>I would like to configure our system to display different messages at login depending upon
>the tty device that the person has connected to.
>
>Does someone have any ideas on how to accomplish this?

The easy way is to put something in the shell startup scripts
(i.e. /etc/csh.login or /etc/profile) that displays a message.

For example, in hp-ux, you find
	if [ -f /etc/motd ]
	then
		cat /etc/motd
	fi

You could easily make a directory /etc/messages/dev and put
files in there with terminal names.  Then
	file=/etc/message`tty`
	if [ -f $file ]
	then
		cat $file
	fi

The tty command will tell you what terminal you are on.  For
example, I am on /dev/ttyp0 right now.  using the above
fragment of sh/ksh, it would set file to "/etc/message/dev/ttyp0",
see if there is a file with that name and print it out.

In csh, you would use something like
	set file=/etc/message`tty`
	if ( -f $file ) cat $file