Re: automatically set DISPLAY after telnet/rlogin ?
I don't think prompts is what he was asking about, nor does he have to use
ssh (although this would be preferrable). I've seen this done using some
shell commands in a .cshrc or .profile file that is called after login.
Here are shell scripts that I found you can source or place in your .cshrc
or .profile. Modify them as necessary:
----------------------------------
C Shell version:
----------------------------------
#!/bin/csh -f
# Script to set the DISPLAY variable for login sessions.
# To use this script, put the line "source /usr/local/bin/setdisplay.csh"
# in your .login file.
#
set UNAME = `uname`
if ( $?DISPLAY ) then
echo "DISPLAY $DISPLAY via environment"
else if ( $term =~ *@* ) then
# kludge to handle setting of DISPLAY variable for X. Requires use of
# 'xrlogin' to work.
setenv DISPLAY `echo $term | sed -e 's/.*@//'`
set term = `echo $term | sed 's/@.*//'`
echo "DISPLAY $DISPLAY via xrlogin"
else if ( $term == "xterm" || $term == "aixterm" || $term == "aixterm-m" || $term == "sun-cmd" ) then
# Even worse kludge. Does not work for X terminals.
# Only node is usually valid, rest is truncated
if ( $UNAME != IRIX64 ) then
set xwhence = `who am i | sed -n -e 's/^.*(\([^.)]*\).*$/\1/p'`
else
set xwhence = `w -h | sed -n -e '/'$USER'/s/^[^A-Z]*\([A-Z]*[^\.]\).*/\1/p' | head -1`
endif
if ( $xwhence == '' ) then
echo "DISPLAY cannot be set via who am i"
unsetenv DISPLAY
else
setenv DISPLAY $xwhence:0
if ( $UNAME != IRIX64 ) then
echo "DISPLAY $DISPLAY via who am i"
else
echo "DISPLAY $DISPLAY via w, WRONG if from Xterminal"
endif
endif
unset xwhence
else
echo "DISPLAY not set, term is $term"
endif
----------------------------------------
Bourne/Korn Shell version:
-----------------------------------------
#!/bin/ksh
#
# to use this script, put the line "source /usr/local/bin/setdisplay"
# in your .login file.
if [ $DISPLAY ]; then
echo "DISPLAY $DISPLAY via environment"
else
if [ ! -z "`echo $TERM | grep '@'`" ]; then
# kludge to handle setting of DISPLAY variable for X. Requires use of
# 'xrlogin' to work.
DISPLAY=`echo $TERM | sed 's/.*@//'`
TERM=`echo $TERM | sed 's/@.*//'`
export DISPLAY TERM
echo DISPLAY $DISPLAY via xrlogin
else
if [ $TERM = xterm -o $TERM = aixterm -o $TERM = aixterm-m -o $TERM = sun-cmd ]; then
# even worse kludge. Does not work for X terminals.
xwhence=`who am i | sed -n -e 's/^.*(\([^.)]*\).*$/\1/p'`;
if [ $xwhence = '' ]; then
echo "DISPLAY cannot be set via who am i"
DISPLAY=
else
DISPLAY=$xwhence:0;
echo DISPLAY $DISPLAY via who am i;
fi
export DISPLAY
xwhence=
fi
fi
fi
------------------------------
Good luck! :)
-Ossama
--
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Reply to: