DISPLAY question

DISPLAY question

Post by Bas V » Sun, 09 Oct 1994 02:09:16



What I would like to do is when I rlogin to another machine
that the DISPLAY variable is set to the machine I'm coming
from.  Is there a way to do this in my .login file?
( I'm using csh ).

Bas

 
 
 

DISPLAY question

Post by James M. Ste » Wed, 12 Oct 1994 01:07:23


|> What I would like to do is when I rlogin to another machine
|> that the DISPLAY variable is set to the machine I'm coming
|> from.  Is there a way to do this in my .login file?
|> ( I'm using csh ).
|>
|> Bas
Clumsy but workable:
        alias rlogin 'echo "setenv DISPLAY $display" >startup; CP \!:1; rlogin'
Write a CP command to copy startup to your remote-node home diretory.
In your remote .cshrc:
        if (! $?DISPLAY) then
                source ~/startup
        endif
You may have to add/change your remote .rhosts to allow rcp.
--
The views stated above are solely my own, not Northrop Grumman's.
Jim Stern       Feedback appreciated    "Murphy was an optimist."

 
 
 

DISPLAY question

Post by Steve Silverm » Wed, 12 Oct 1994 21:09:26



> What I would like to do is when I rlogin to another machine
> that the DISPLAY variable is set to the machine I'm coming
> from.  Is there a way to do this in my .login file?
> ( I'm using csh ).

> Bas

who -uR | grep `ps -fp $$ | tail -1 | awk '{print $6}'` |
  awk '{print $8":0.0"} > junk
setenv DISPLAY `cat junk`
rm junk

--
       ____/             ____/     |     Steve A. Silverman
     /         __  /   /           |     AlliedSignal Technical Services Corp.
   ____  /    /   /  ____  /       |     -------------------------------------
        /    __  /        /        |     Network Planning and Analysis System
 ______/  __/ __/  ______/         |     NASA GSFC Code 534.2

 
 
 

DISPLAY question

Post by Bas V » Thu, 13 Oct 1994 06:35:25





: |> > What I would like to do is when I rlogin to another machine
: |> > that the DISPLAY variable is set to the machine I'm coming
: |> > from.  Is there a way to do this in my .login file?
: |> > ( I'm using csh ).
: |> >
: |> > Bas
: |>
: |> who -uR | grep `ps -fp $$ | tail -1 | awk '{print $6}'` |
: |>   awk '{print $8":0.0"} > junk
: |> setenv DISPLAY `cat junk`
: |> rm junk
: |>[...]
: Good idea but won't always work.  I tested this on an xterm, call it XXX,
: which is hooked to host HHH.  I rlogin-ed from HHH to remote
: host RRR and tried "who -uR".  Result: HHH, not XXX.  Does anyone
: know a trick that works for xterms too?

The problem is that when you rlogin from a X-terminal the DISPLAY
is set to the host name.  Also when you rlogin to machine A then
from there to machine B etc.  your DISPLAY will also have the wrong
contents.  The answers I have gotten I have kinda combined and I
came to the following solution:

I have assumed here that the first time you login it is on 'your'
machine and the DISPLAY and TERM have been 'normally' set.  Or
use the who -uR stuff written above.  I have added the following
lines to my .cshrc file on those machines that I usually rlogin to.
This solution took in account that the TERM variable is propagated
when you rlogin to another machine:

if( ! $?DISPLAY ) then
   setenv DISPLAY  `printenv TERM | awk '{ FS = "%" } { print $2 }'`
   setenv TERM `printenv TERM | awk '{ FS = "%" } { print $1 }'`
endif
alias   rlogin  'setenv ST $TERM;setenv TERM $TERM%$DISPLAY; \
                /usr/bin/rlogin \!*;setenv TERM $ST'

Bas

 
 
 

DISPLAY question

Post by Mike Trayn » Thu, 13 Oct 1994 08:04:51


: if( ! $?DISPLAY ) then
:    setenv DISPLAY  `printenv TERM | awk '{ FS = "%" } { print $2 }'`
:    setenv TERM `printenv TERM | awk '{ FS = "%" } { print $1 }'`
: endif
: alias   rlogin  'setenv ST $TERM;setenv TERM $TERM%$DISPLAY; \
:                 /usr/bin/rlogin \!*;setenv TERM $ST'

Cute.  Take advantage of the variables which ARE passed around.  This
can be quite useful if you use remsh/rlogin...

Here's what I do for ksh; it has the same problems as previously
described (only works if the source node is the node on which the
server is running):

export DISPLAY=`who -uRm | sed 's/:0\.0$//' | awk '{printf"%s:0.0",$NF'`

This works for me 90+% of the time.  The rest of the time, I set the
display variable by hand.  Usually AFTER sending the output to some
other unsuspecting soul's workstation.

-Mike

 
 
 

DISPLAY question

Post by Jostein Andre Solha » Thu, 13 Oct 1994 06:23:58



|> |> who -uR | grep `ps -fp $$ | tail -1 | awk '{print $6}'` |
|> |>   awk '{print $8":0.0"} > junk
|> |> setenv DISPLAY `cat junk`
|> |> rm junk

or : setenv DISPLAY `who -R am i | cut -d "(" -f 2 | cut -s -d ")" -f 1`

But 'who' can give wrong result when using rlogin because it only
tells what host you're logging in from. Not the xterm your sitting on.
Rlogin does not transport the display variable with it.
One way to owercome this, is by using rcp as suggested earlier.
But if you can use rcp, you probably can use remsh too :

remsh <host> -l <user> -n xterm $DISPLAY

works fine for me...
jostein

 
 
 

DISPLAY question

Post by James M. Ste » Thu, 13 Oct 1994 02:31:46



|> > What I would like to do is when I rlogin to another machine
|> > that the DISPLAY variable is set to the machine I'm coming
|> > from.  Is there a way to do this in my .login file?
|> > ( I'm using csh ).
|> >
|> > Bas
|>
|> who -uR | grep `ps -fp $$ | tail -1 | awk '{print $6}'` |
|>   awk '{print $8":0.0"} > junk
|> setenv DISPLAY `cat junk`
|> rm junk
|>[...]
Good idea but won't always work.  I tested this on an xterm, call it XXX,
which is hooked to host HHH.  I rlogin-ed from HHH to remote
host RRR and tried "who -uR".  Result: HHH, not XXX.  Does anyone
know a trick that works for xterms too?
--
The views stated above are solely my own, not Northrop Grumman's.
Jim Stern       Feedback appreciated    "Murphy was an optimist."
 
 
 

DISPLAY question

Post by James M. Ste » Fri, 14 Oct 1994 03:33:20



|>
|> : if( ! $?DISPLAY ) then
|> :    setenv DISPLAY  `printenv TERM | awk '{ FS = "%" } { print $2 }'`
|> :    setenv TERM `printenv TERM | awk '{ FS = "%" } { print $1 }'`
|> : endif
|> : alias   rlogin  'setenv ST $TERM;setenv TERM $TERM%$DISPLAY; \
|> :                 /usr/bin/rlogin \!*;setenv TERM $ST'
|>
|> Cute.  Take advantage of the variables which ARE passed around.  This
Indeed.

|> can be quite useful if you use remsh/rlogin...
|> [...]
I just thought of a way to dispense with awk.  On the host node:
        setenv TERM 'setenv TERM '$TERM';setenv DISPLAY '$DISPLAY
On the remote host:
        eval $TERM

This is all csh syntax.  I believe the trick can be adapted to sh and ksh.
|--
The views stated above are solely my own, not Northrop Grumman's.
Jim Stern       Feedback appreciated    "Murphy was an optimist."

 
 
 

DISPLAY question

Post by James V. Ryan (V » Sun, 16 Oct 1994 22:43:32




>> What I would like to do is when I rlogin to another machine
>> that the DISPLAY variable is set to the machine I'm coming
>who -uR | grep `ps -fp $$ | tail -1 | awk '{print $6}'` |
>  awk '{print $8":0.0"} > junk
>setenv DISPLAY `cat junk`
>rm junk

or you could at the end of you .login put:

set dev = `tty |  cut -f4 -d/`
set wd = `who -uH | /bin/grep $dev | awk '{ print $8 }'`
setenv DISPLAY $wd

Vic
--
James V. Ryan  (Vic)            Communications Link Analysis & Simulation System
Code 530.2, Bldg. 25, N105C      AlliedSignal  Technical  Services  Corporation

Greenbelt, MD  20771            Fax - Prime: 301-286-4672,  Backup: 301-286-1770

 
 
 

1. HP9000 Display Question

I have some HP machines (K370, B132L) that have a gfx subsystem. All the
machines have a DVI-style connector (HP ECV?) for the monitor and use an
adapter to connect to standard VGA HD15. My question: is this connector
DVI-compatible? Can I connect a standard Flat Panel to that connector?

Benjamin

2. Network Problem

3. 700 series' display questions

4. Tandy 2500sx Upgrade?

5. How to Display Bitmap on root display?

6. The table is full

7. Preventing X display to inactive displays?

8. CD^32 advert on the radio

9. Display of console display in another hpterm server

10. display of physical memory question

11. Questions about moving Panel in Vue; and font questions

12. Can't Open Display

13. Want to display OVO on a Linux-Machine