Solved

exporting DISPLAY

Posted on 1997-10-29
7
408 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
7 Comments
 
LVL 84

Expert Comment

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

Expert Comment

by:ahoffmann
Comment Utility
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
Comment Utility
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
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
Comment Utility
xterm always inherits teh whole enviroment to the shell it creates. No problem :)
0
 
LVL 1

Expert Comment

by:dhughes111797
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

The DSL Parameters part of this article is valid and can be considered with any brand of internet router and modem (Dlink, 3com, Alcatel, Usrobotics, Parks), by accessing the configuration interface available by the manufacturer eg: http://10.1.1.1 …
I was recently sitting at a desk at work with one of my colleagues and needed some information on my home computer. He watched as I turned on my home computer, established a remote session into it, got the information I needed and then shut it down …
Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now