Eric on 26 Jan 2010 16:40:50 -0800


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

[PLUG] Detecting X Windows in a shell script


I know there are some real kick-butt shell programmers here so here's a
question that is stumping me:

I want to modify my .profile file so that when I log in and I am logged
in to X Windows then the command "xhost +localhost" is executed.  
Obviously, when I'm not running X Windows then running this command is
useless.

Perhaps I could detect that I'm logged in to Gnome instead?

I could also just always run it like this:  xhost +localhost >/dev/null 2>&1
so I just don't see the error message but that is ugly.

Google has not been helpful to me for this :-(

Thanks,
Eric

-- 
#  Eric Lucas
#
#                "Oh, I have slipped the surly bond of earth
#                 And danced the skies on laughter-silvered wings...
#                                        -- John Gillespie Magee Jr

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug