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

Re: best way to check for an active X session from a maintainer script?



On Tue, 11 Sep 2007 09:55:00 -0500 Manoj Srivastava wrote:

>         Umm. I am in X, right now.
> __> who | awk '{print $2}'|grep -q '^:[0-9]'
> __> 
> 
>         Do I need to be root?
> __> sudo who | awk '{print $2}'|grep -q '^:[0-9]'
> __> 

Did you check the exit-code of grep? -q is kinda quiet, you know ;)

>         So, this does not seem to work in all cases.

However, THAT is right and was already corrected, the ^ is unnecessary.

Regards
Evgeni



Reply to: