Solved

exporting DISPLAY

Posted on 1997-10-29
7
416 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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
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 100 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

If you're not part of the solution, you're part of the problem.   Tips on how to secure IoT devices, even the dumbest ones, so they can't be used as part of a DDoS botnet.  Use PRTG Network Monitor as one of the building blocks, to detect unusual…
This article explains the fundamentals of industrial networking which ultimately is the backbone network which is providing communications for process devices like robots and other not so interesting stuff.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses
Course of the Month4 days, 22 hours left to enroll

636 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