Operating System - HP-UX
1829070 Members
2735 Online
109986 Solutions
New Discussion

Trouble with the DISPLAY variable

 
SOLVED
Go to solution
Göran Berlemo
Occasional Advisor

Trouble with the DISPLAY variable

Hello!

I have a problem with the DISPLAY variable when I try to start an application on another server.

Server A is the one I am logged in to. Server B is the one holding the application I want to start. How do I set the DISPLAY variable to point to my screen without typing my screens name in. I.e. I want the DISPLAY to be set dynamicaly depending on whatever server/X-window terminal I'm using. This should be done in a script/ several scripts.
(the -display flag isn't availible for the application, sadly).

Regards
4 REPLIES 4
Frederic Soriano
Honored Contributor

Re: Trouble with the DISPLAY variable

Hi Goran,

You can use this piece of (sh) script (in your profiles for instance):

--snip--
DISPLAY_HOST=$(who -muR | awk '{print $NF}')
DISPLAY_HOST=${DISPLAY_HOST%%:0.0}
DISPLAY=$DISPLAY_HOST:0.0
export DISPLAY
--snip--

But this will work only from one server to another one. If you are on server A, and logs onto server B, then DISPLAY will be set to A:0.0. But if you are logging onto server C from server B, then DISPLAY will be set to B:0.0 !

I hope this helps !

Best regards.

Fred.
Bill McNAMARA_1
Honored Contributor

Re: Trouble with the DISPLAY variable

Good script!
Hey, there's another discussion on this
relating to a problem with root user opening
display. Pay attention and make sure the .profile is sourced by dt on dtlogin!
Well that's the hunch!!

Later,
Bill
It works for me (tm)
Göran Berlemo
Occasional Advisor

Re: Trouble with the DISPLAY variable

Hello again.

Is there any way to make the DISPLAY variable point to server A when logging into B and then C? That would be very useful. =)

Bill:

Which forum and what is the title/subject of that discussion?

/regards
Frederic Soriano
Honored Contributor
Solution

Re: Trouble with the DISPLAY variable

Goran,

I think that the only way to do that is to encode the DISPLAY information into the TERM variable: have a look at the following thread:

http://forums.itrc.hp.com/cm/QuestionAnswer/1,1150,0x4f7d37f45ef7d4118fef0090279cd0f9,00.html

And more precisely to the last post, from Tim Malnati. There is a script attached that should help you.

Wishing you luck.

Best regards.

Fred.