Re: automatically set DISPLAY after telnet/rlogin ?
On Wed, Mar 18, 1998 at 10:50:51PM +0100, Michael Agbaglo wrote:
> is there is nice way to have the DISPLAY-Variable automatically set to
> the host from where I logged in ?
Well I have two suggestions:
1. use ssh, that's what I use now
2. This option may not qualify as "nice." Looking at it right now, I'm
not sure it does the right thing for local displays, but I don't use it
anymore anyway. It did seem to set the display properly through one
level of remote logins. I had this code in my .kshrc and then in my
.bashrc for figuring out the display:
# Get machine architecture
case `/bin/uname 2> /dev/null` in
SunOS )
if [ `uname -r | cut -d "." -f 1` = "4" ]; then
ARCH="sun"
elif [ `uname -r | cut -d "." -f 1` = "5" ]; then
ARCH="solaris"
else
ARCH="unknown_sun"
fi ;;
HP-UX )
if [ `uname -r | cut -d "." -f 2` = "09" ]; then
ARCH="hp700_9"
elif [ `uname -r | cut -d "." -f 2` = "10" ]; then
ARCH="hp700_10"
else
ARCH="unknown_hp"
fi ;;
Linux ) ARCH="i486" ;;
* ) ARCH="unknown" ;;
esac
# set display
case $ARCH in
hp700_*) options="-R" ;;
sun ) options="" ;;
solaris ) options="" ;;
* ) options="" ;;
esac
if [ -z "$DISPLAY" ]; then
dis=`who am i $options | sed -e "s/(//" -e "s/)//" | awk '{printf "%s",$6}'`
case "$dis" in
:[0-9].[0-9]) DISPLAY=`hostname`${dis%.0} ;;
*:[0-9].[0-9]) DISPLAY=${dis%.0} ;;
*:[0-9]) DISPLAY=$dis ;;
*) DISPLAY=${dis}:0 ;;
esac
else
DISPLAY=${DISPLAY%.0}
fi
export DISPLAY
--
Lee Bradshaw lee@sectionIV.com (preferred)
Next Level Communications bradshaw@nlc.com
--
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Reply to: