home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.sun.admin
- Path: sparky!uunet!snorkelwacker.mit.edu!bloom-picayune.mit.edu!news.mit.edu!jdell
- From: jdell@nefertiti.mit.edu (John Ellithorpe)
- Subject: Re: auto set display variable on X terms
- In-Reply-To: ccarpent@dw3f.ess.harris.com's message of Thu, 20 Aug 1992 14:40:01 GMT
- Message-ID: <JDELL.92Aug20164831@nefertiti.mit.edu>
- Sender: news@athena.mit.edu (News system)
- Nntp-Posting-Host: nefertiti.mit.edu
- Organization: Massachusetts Institute of Technology
- References: <1992Aug20.144001.1759@trantor.harris-atd.com>
- Date: Thu, 20 Aug 1992 21:48:31 GMT
- Lines: 39
-
- On Thu, 20 Aug 1992 14:40:01 GMT, ccarpent@dw3f.ess.harris.com (Craig Carpenter) said:
-
- > --
- > I am looking for the easy way to set the DISPLAY variable when a user
- > signs in. We have some
- > X terminals and they login to the Sparc and have to set the display
- > variable themselves,
- > what is the easy way to find out from the login process what terminal
- > they are signing in from.
-
- Using the output of 'who am i' usually works, but has some drawback.
-
- set disphost=`who am i | sed -n -e 's/^.*(//;s/)$//;l'`
-
- This will be fine, if the X-Terms have names which aren't too long. If they
- are over (I think?) 13 chars, then you can just look for the parse the
- 'who am i' output for matching characters and fill in the rest yourself, i.e.
-
- # Hosts all in same domain
- set possible_hosts=(host_a host_b host_c)
-
- foreach hostcheck ( $possible_hosts )
- if ( `echo $defhost | egrep -c $hostcheck` != 0 ) then
- setenv DISPLAY $hostcheck.domain:0.0
- endif
- end
-
- Was that clear enough? Well, anyway, this seems to work. The only place
- this won't work is if you decide to log into another computer. But it's
- a start.
-
- --John
- --
- ===============================================================================
- John Ellithorpe | Internet: jdell@maggie.mit.edu
- Dept. of Physics, Rm 26-349 | Phone : (617) 253-3074 Office
- Massachusetts Institute of Technology | (617) 253-3072 Lab
- Cambridge, MA 02139 | (617) 236-4910 Home
- ===============================================================================
-