Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss] Most reliable method to test if x server is running in a Bourne Shell script



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>



BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org