Hi All,

I am having a linux machine and i used to work on this machine either directly or by using vncviewer from my windows machine. So everytime i launch new terminal on my vnc view i need to set DISPLAY. So i added the following code in my .cshrc


Code:

if ($?VNCDESKTOP == 1) then
setenv DISPLAY `echo $VNCDESKTOP | awk '{printf $1}'`
else
setenv DISPLAY ${HOSTNAME}:0
endif


So in this code i am checking that if VNCDESKTOP variable is set, so that means i am using vncviewer and set DISPLAY as per Vncviewer i had opened otherwise i am working directly on Linux machine.

Now this code works fine as long as i work on my own machine. Problem is when i did rsh to some other linux machine.

Problem1:
If i do rsh on my linux standalone machine, then HOSTNAME is changed and else part of code is of no use. So i have to hard code this part. Can some one tell me how can i make it work, i searched on net and found some thing about $REMOTEHOST. So can i use this for this problem.

Problem2:
Problem1 however has a workaround that i can hard code display but problem 2 is more severe. When i do rsh using my vncviewer, i found that VNCDESKTOP is not set there. Hence i again need to set it manually. Is there any other variable or way by which i can detect that i am still on vncviewer and can set DISPLAY.

Thanks
Sarbjit