home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / sun / admin / 5707 < prev    next >
Encoding:
Text File  |  1992-08-20  |  2.1 KB  |  53 lines

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