Hi all,
Im using a network where PC's connect via Exceed to Unix hosts. Users have to set the DISPLAY variable and I thought I could make this automatic. I wrote the script below invoked (in the .cshrc). This works ok, even when jumping to other machines mid session with rlogin, ssh etc. But this looks just looks excessive, There must be an easier way to do this? any ideas?
set DISPSESSION=`(tty|sed s^/dev/^^)`
setenv DISPLAYNODE `(who | grep "$DISPSESSION " | awk '{print $6}'|sed 's/(//'|sed 's/)//')`
# Check that the host has a "." in it (either an IP address, .dom or 0.0)
if (($DISPLAYNODE != "") && (`echo $DISPLAYNODE | grep -c "\."` != 0)) then
rm -f ~/.DISPLAY
if (`echo $DISPLAYNODE | grep -c "0.0"` == 0) then
# Add :0.0 to end of IP address
echo "$DISPLAYNODE"":0.0" > ~/.DISPLAY
else
# Dont need 0.0 since already present
echo "$DISPLAYNODE" > ~/.DISPLAY
endif
endif
if (-f ~/.DISPLAY) then setenv DISPLAY `cat ~/.DISPLAY`
Im using a network where PC's connect via Exceed to Unix hosts. Users have to set the DISPLAY variable and I thought I could make this automatic. I wrote the script below invoked (in the .cshrc). This works ok, even when jumping to other machines mid session with rlogin, ssh etc. But this looks just looks excessive, There must be an easier way to do this? any ideas?
set DISPSESSION=`(tty|sed s^/dev/^^)`
setenv DISPLAYNODE `(who | grep "$DISPSESSION " | awk '{print $6}'|sed 's/(//'|sed 's/)//')`
# Check that the host has a "." in it (either an IP address, .dom or 0.0)
if (($DISPLAYNODE != "") && (`echo $DISPLAYNODE | grep -c "\."` != 0)) then
rm -f ~/.DISPLAY
if (`echo $DISPLAYNODE | grep -c "0.0"` == 0) then
# Add :0.0 to end of IP address
echo "$DISPLAYNODE"":0.0" > ~/.DISPLAY
else
# Dont need 0.0 since already present
echo "$DISPLAYNODE" > ~/.DISPLAY
endif
endif
if (-f ~/.DISPLAY) then setenv DISPLAY `cat ~/.DISPLAY`