I have been using Solaris 8 systems a lot lately and have been writing some minor scripts to speed up some common tasks. The latest script I have done finds out the IP address of the system you telneted from and then sets the DISPLAY enviroment to that IP address in csh. Why would I want to do this? Because I telnet into this system from my windows system - on my windows system I have an XServer running (Exceed) and this sends the graphical display to pop up on my system.
The script:
The way I have the script set up with the if statement solves the problem of running this script from the console (sitting at the actual computer) but doesn't fix the problem of someone telneting from computer A to B and then finally C. If you run this script it tries to send the X window to computer B and not A.....anyone know how I can solve this problem?
The script:
Code:
#!/bin/csh
setenv DEV `tty | awk -F// '{printf("%-0s%-0s%-0s",$3,"/",$4)}'`
setenv DEVLINE `who | grep $DEV | awk -F\( '{print $2}' | awk -F\) '{print $1}'`
if (( DEVLINE == :0 ) || ( DEVLINE == :0.0 )) then
setenv DISPLAY ${DEVLINE}
else
setenv DISPLAY ${DEVLINE}:0.0
endif
The way I have the script set up with the if statement solves the problem of running this script from the console (sitting at the actual computer) but doesn't fix the problem of someone telneting from computer A to B and then finally C. If you run this script it tries to send the X window to computer B and not A.....anyone know how I can solve this problem?