Solved

exporting DISPLAY

Posted on 1997-10-29
7
412 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
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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Short answer to this question: there is no effective WiFi manager in iOS devices as seen in Windows WiFi or Macbook OSx WiFi management, but this article will try and provide some amicable solutions to better suite your needs.
In this article, I am going to show you how to simulate a multi-site Lab environment on a single Hyper-V host. I use this method successfully in my own lab to simulate three fully routed global AD Sites on a Windows 10 Hyper-V host.
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…

776 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