[ILUG] Identifying telnet connections?
Justin Mason
jm at netnoteinc.com
Thu Jun 3 10:40:48 IST 1999
Paul Jakma said:
> export DISPLAY=`last -a -n 1 $USER | awk '/mydomain.ie/ { print $10 }'`
>
> would do the trick.
> it works for me, the reason for using the domain name is cause i can't see
> how to get the username into the awk pattern, eg:
>
> awk '/$USER/ { print $10}' doesn't work cause the awk command string isn't
> parsed by bash.
>
> and awk '/ENVIRON["USER"] {print $10 }' doesn't do it either.
> any awk/perl hackers out there?
last -a -n 1 $USER | awk '{print $10}'
seems to work OK. But it's a bit flawed this way of doing things IMHO, as
at least on my RH5.2 machine, you get an incorrect $DISPLAY setting when
you start a local rxvt.
What I usually do is write the current display into ~/.display from the
.xsession or .xinitrc script, then source that from the ~/.bashrc file --
that way everywhere gets the right value, as long as ~ is shared via NFS.
like so (in the .xsession):
$HOME/bin/fulldisplay > $HOME/.display &
where ~/bin/fulldisplay is a script like this:
#!/bin/sh
[ "${DISPLAY:-unset}" = unset ] && exit 1
case "$DISPLAY" in
:0* ) echo `uname -n`:0 ;;
* ) echo $DISPLAY ;;
esac
exit 0
BTW regarding sweetr's mail -- I can see your point. Personally I didn't
respond because I know FA about configuring gnome or E ;). As to the lack
of replies: I think a common reason for this would be because a reply
message saying "can't help here, I don't have a clue" would be widely
construed as just a waste of bandwidth.
--j.
More information about the ILUG
mailing list