Here's what I tried in my .bashrc:
DISPLAY=$(who am i | perl -pe 's/.*\((.*)\)/$1:0.0/')
export DISPLAY
Here's the result:
$ xtermWarning: This program is an suid-root program or is being run by the root user.The full text of the error or warning message cannot be safely formattedin this environment. You may get a more descriptive message by running theprogram as a non-root user or by removing the suid bit on the executable.xterm Xt error: Can't open display: %sxterm: DISPLAY is not set$ echo $DISPLAY10.110.2.214:0.0
$ export DISPLAY=10.110.2.214:0.0$ xterm(xterm displays as expected)
This drove me crazy for longer than it should have. I even ran:
echo $DISPLAY | od -c
and that showed no extra characters at all. I was at my wit's end until I simply tried a different set of commands to set DISPLAY. The one that works is:
REMOTE_HOST_IP=$(who am i | awk '{print $NF}' | tr -d ')''(' )DISPLAY=$REMOTE_HOST_IP:0.0export DISPLAY
This is on AIX 7.3, with what I'm certain are strange and old versions of perl and bash (they behave oddly in other situations, too), but wanted to share my silly solution.
No comments:
Post a Comment