Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!udel!haven!adm!smoke!brl.mil!moss From: moss@brl.mil (Gary S. Moss (VLD/VMB) ) Newsgroups: comp.windows.x Subject: Re: setenv DISPLAY automatically Message-ID: <14494@smoke.brl.mil> Date: 16 Nov 90 18:54:48 GMT References: <9011112317.AA21302@Larry.McRCIM.McGill.EDU> <1248@phcisa.UUCP> Sender: news@smoke.brl.mil Reply-To: moss@brl.mil Organization: Ballistic Research Laboratory Lines: 64 In article <1248@phcisa.UUCP>, frans@phcisa.UUCP (Francois Staes) writes: |> A simple solution might be to use |> |> rsh -n /usr/bin/X11/xterm -display $DISPLAY |> |> This causes the DISPLAY variable to contain the right value, even in the |> child process of the xterm. (See man page of xterm) |> |> One problem left: you have to change the initial value of your DISPLAY |> variable from unix:0 to :0. Is there any way that |> xinit sets the initial DISPLAY variable to :0 instead of unix:0 ? |> Or does this cause any performance problems ? I have a version of xrsh that I've hacked just a little which is nice to use for remote execution of X clients. Not only does it set up the DISPLAY variable automatically, but it runs xhost, adds X stuff to your path and sets LD_LIBRARY_PATH in case you are using shared libraries. Using xrsh, the above line would turn into the following: xrsh xterm Below is the xrsh, the comment is not mine, it came with it, and you may need to change the list of directories that it appends to PATH: -Gary #! /bin/sh # # start an X11 process on another host # # Date: 8 Dec 88 06:29:34 GMT # From: Chris Torek # rsh $host -n "setenv DISPLAY $DISPLAY; exec $@ &/dev/null" # # An improved version: # rXcmd (suggested by John Robinson, jr@bbn.com) # (generalized for sh,ksh by Keith Boyer, keith@cis.ohio-state.edu) # # but they put the rcmd in ()'s which left zombies again. This # script combines the best of both. case $# in [01]) echo "Usage: $0 host x-cmd [args...]";; *) case $SHELL in *csh*) host="$1"; shift xhost "$host" > /dev/null rsh "$host" -n \ "setenv TERM xterm; setenv DISPLAY `hostname`:0; \ exec $* & /dev/null" & ;; *sh) host="$1"; shift xhost "$host" > /dev/null rsh "$host" -n \ "TERM=xterm export TERM; \ DISPLAY=`hostname`:0 export DISPLAY; \ LD_LIBRARY_PATH=/usr/X11/lib export LD_LIBRARY_PATH; \ PATH=\$PATH:/usr/X11/bin:/usr/bin/X11:/usr/local/bin; \ export PATH; \ exec $* < /dev/null > /dev/null 2>&1" & ;; esac ;; esac