Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

exporting DISPLAY

Posted on 1997-10-29
7
Medium Priority
?
419 Views
Last Modified: 2013-12-23
       I am trying to figure out how to set it up so that when open a new shell with xterm, it sets DISPLAY on the new shell the same as it was onthe old shell (NOT to the computer where the old shell is).  
        If it were just rlogin and not xterm I could just modify TERM, but xterm sets that variable to 'xterm' automatically.  Are there any other variables that are passed?  Is there anyway to read the title bar of an
xterm window (just set it equal to the display)?  Any other ideas?
0
Comment
Question by:cplager
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 1582752
Are you saying DISPLAY is not being passed to the new shell?
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 1582753
I'm a bit confused. Is you problem DISPLAY in a new xterm, or after rlogin to an other host?

If you just miss DISPLAY, set it in your shell's system profile
(/etc/csh.login, /etc/profile, many more ... depends on your OS
*and* your shell).
If you need to set DISPLAY after rlogin to the host where you
typed rlogin, you need a more sophisticated solution (IRIX for
example passes REMOTEHOST to the shell); stacked rlogins will be
a problem too.

> Is there anyway to read the title bar of an xterm ...
Not easy, means from within the shell.
To set the title you may use:

   echo -n "^[]0;\!*^G"

NOTE that  ^[  is ESC (0x1b), and  ^G  is  BEL  (0x07).



0
 

Author Comment

by:cplager
ID: 1582754
Let me try and clarify the problem.  I login from my computer at come home.org.  I then run an xterm on one.org with DISPLAY set to home.org.  When I run a new xterm from one.org to two.org, I do not want my DISPLAY set to one.org, but rather home.org (as it is set one one.org).  How can I set this up automatically?
0
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

 
LVL 51

Expert Comment

by:ahoffmann
ID: 1582755
Not easy. That's what I meant by "more sophisticated".
Your problem is similar to nested rlogins. If there are different
operating systems, things get complicated.
I can give you a solution for primary rlogin, but for all follow-
ing nested ones I just have hints.

You must do somthing like:
   tty      tells you on which device your shell (xterm) is
   ps ax    search for lines which belong to this tty
            get the PPID of the shell of this tty
            then get tty of PPID
   w        search line with PPID's tty, it contains the name
            of the host where it is from
            set DISPLAY to that host

I've seen a posting in e-e, where an expert sad that this all
could be done via the files utmp (or wtmp?), may be with the last
command, see (I'm not shure this works nested):
   /www.experts-exchange.com/topics/bin/ShowQ?qid=8630005776

Feel free to ask me for more help, good luck.
           
0
 
LVL 2

Accepted Solution

by:
df020797 earned 200 total points
ID: 1582756
xterm always inherits teh whole enviroment to the shell it creates. No problem :)
0
 
LVL 1

Expert Comment

by:dhughes111797
ID: 1582757
Here are a few ideas.
1) if you start a new xterm from your existing xterm, it will
have the DISPLAY set just fine.
2) If you use ssh, your display will be set automatically
(even the first time) - requires installing ssh on home.org and one.org
3) if you have passwordless login enabled through rsh/rhosts, you can use a program called xrsh - ftp.x.org:contrib/utilities/xrsh-5.8.shar.gz
0
 

Expert Comment

by:grantk
ID: 1582758
If you're using telnet, you can create a ~/.telnetrc containing:
 hostname environ define DISPLAY $DISPLAY
 hostname environ export DISPLAY
Note that you may need to re-create this file every time you log on, as the value of $DISPLAY must be hardcoded.

If you're using rlogin/rsh, you can carry the variables across in other variables which you know will get sent. So, you create a rlogin wrapper as such:
 #!/bin/sh
 # rlogin wrapper to send extra variables in USER
 # Grant Kaufmann 1997 grant@intekom.com

 # SETUP vars. site specific
 # location of rlogin
 RLOGIN=/usr/bsd/rlogin
 # command which prints out env names. might be "env" or "export"
 PRINTENV=printenv
 # where is egrep
 EGREP=/usr/bin/egrep
 # whats going with us. egrep format
 COPY_VARS="^TERM=|^DISPLAY=|^LINES="

 NEWENV=`$PRINTENV | $EGREP "$COPY_VARS"`

 # redefine $USER cos its going anyway. You could use TERM or something
 USER="$RLOGIN_ENV" $RLOGIN $*

And then in the receiving host:

 # Grant Kaufmann 1997 grant@intekom.com
 # put this in your startup file on the dest machine
 # set variables fromm a rlogin session
 # using korn/bourne again/etc, make SETENV="export". Otherwise "setenv"
 SETENV=export
 NEWVARS=`echo $USER |/bin/sed -n 's/\([^=]*\)=\([^ ]*\)/ $SETENV \1 "\2";/gp' `
 eval $EVARS

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I had an issue with InstallShield not being able to use Computer Browser service on Windows Server 2012. Here is the solution I found.
During and after that shift to cloud, one area that still poses a struggle for many organizations is what to do with their department file shares.
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

661 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question