[Discuss] Most reliable method to test if x server is running in a Bourne Shell script
Ben Eisenbraun
bene at klatsch.org
Thu Sep 8 15:47:11 EDT 2011
On Thu, Sep 08, 2011 at 03:33:55PM -0400, Jerry Feldman wrote:
> But, the real issue is the line: testxworking. I want a short program
> that returns 0 if an x server is present, and non-zero if not.
$ xset q > /dev/null
$ echo $?
0
$ unset DISPLAY
$ xset q > /dev/null
xset: unable to open display ""
$ echo $?
1
I would check that xset is a required part of the Xorg base installation; I
don't know off the top of my head. If not xset, then xrdb(1) or something
along those lines must ride along with the base installation.
-ben
p.s. Putty setting DISPLAY when none exists is a bug.
--
human history becomes more and more a race between education and
catastrophe. <h.g. wells>
More information about the Discuss
mailing list