Operating System - HP-UX
1846973 Members
5200 Online
110257 Solutions
New Discussion

Re: Automatic DISPLAY setting

 
SOLVED
Go to solution
Russ McGinley
Advisor

Automatic DISPLAY setting

I remote administer 90% of our workstations. I know there's something that you can put in the .cshrc to automatically set your DISPLAY to whatever IP you're telnetting from. Anyone have a clue what it is?
4 REPLIES 4
James R. Ferguson
Acclaimed Contributor
Solution

Re: Automatic DISPLAY setting

Hi Russ:

# who -mR|awk '{print $6}'|tr -d "("|tr -d ")"

Regards!

...JRF...
Robert-Jan Goossens
Honored Contributor

Re: Automatic DISPLAY setting

Hi,

# Be sure that VUE does not invoke tty commands

if [ ! "$VUE" ]; then

# -- Do trick to set the display in case of remote login
HOST=`who am i -R |awk '{print $NF}' | sed "s/(\(.*\))/\1/"`
if [ "$HOST" != "" ] && [ "$HOST" != ":0" ] && [ "$HOST" != ":0.0" ];
then
if [ "$HOST" = `who am i -R |awk '{print $NF}' | sed "s/(\(.*\))/\1/"` ]
then
HOST=$HOST:0.0
fi
echo " +--<<"
echo " | Remote login detected, setting DISPLAY to $HOST"
echo " +-->>"
DISPLAY=$HOST
export DISPLAY
fi

Regards,

Robert-Jan.
Bernhard Mueller
Honored Contributor

Re: Automatic DISPLAY setting

Hi,

if you're the only one using the root account you could very well set up something using the output of a "who -u"

If you a using rlogin I could also send you a script that takes care of setting the DISPLAY.

Regards
Bernhard
Rick Garland
Honored Contributor

Re: Automatic DISPLAY setting

Another option:

who -um | awk '{print $NF}'

Example,

export DISPLAY=`who -um | awk '{print $NF}':0.0`