On 28-Mar-07 10:32:19, Chris G wrote:
Does anyone have any neat/elegant/clever ways of setting the DISPLAY variable when working in a situation where I may use X in different places and want to run X applications from different remote machines?
You could try on the lines of the following, where the context is that you want to set the DISPLAY variable variable on machine A, to which you are logged in from machine B (hence want to run an X app on A and see its X display on machine B).
On machine A, make use of 'who am i' to find out the hostname or IP address of machine B (it's in field 6 of the output of 'who am i', within brackets); hence use this to set the DISPLAY.
Example (I'm currently logged in to A=nessie.mcc.ac.uk from one of my home machines, B, and entering the following from B):
bash$ who am i efh ttyp3 Mar 28 12:16 (88.96.44.206)
bash$ who am i | awk '{print $6}' (88.96.44.206)
bash$ who am i | awk '{print $6}' | tr -d "()" 88.96.44.206
bash$ export DISPLAY=`who am i | awk '{print $6}' | tr -d "()"`:0.0 bash$ echo $DISPLAY 88.96.44.206:0.0
Not that that would really work in my case, since 88.96.44.206 is the IP of my broadband connection, not of any one of my individual home machines (whichever one I'm logged in from, I get the same IP from the remote host):
bash$ /usr/X11R6/bin/xterm _X11TransSocketINETConnect: Can't connect: errno = 61
but that's another issue!
Dunno if that helps ... !! Ted.
-------------------------------------------------------------------- E-Mail: (Ted Harding) ted.harding@nessie.mcc.ac.uk Fax-to-email: +44 (0)870 094 0861 Date: 28-Mar-07 Time: 12:49:02 ------------------------------ XFMail ------------------------------