David Coulson on 26 Jan 2010 16:44:13 -0800


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

Re: [PLUG] Detecting X Windows in a shell script


Just check to see if $DISPLAY is set... That's usually a good enough test.

On 1/26/10 7:40 PM, Eric wrote:
> 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
>
>    
___________________________________________________________________________
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