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.
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!