Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 11-19-2005, 01:30 AM   #1
Senior Member
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,232

Rep: Reputation: 299Reputation: 299Reputation: 299
Bash script - how to tell if in GUI or CLI?

I've a handy program called pop3check that checks my email once an hour. What I want to do is run a small script when I have mail that -

If in GUI runs a kdialog box, or
If in CLI plays a notify sound and echos to terminal

So how can I tell from a script what runlevel I'm in? This is in Slackware.

Old 11-19-2005, 02:08 AM   #2
Senior Member
Registered: Aug 2005
Posts: 1,755

Rep: Reputation: 49
you can check whether the $DISPLAY variable is set
Old 11-19-2005, 02:12 AM   #3
Senior Member
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,232

Original Poster
Rep: Reputation: 299Reputation: 299Reputation: 299
Thanks, that's exactly what I'm after


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
boot CLI vs GUI weazy Linux - Software 2 08-04-2006 09:15 PM
Suse 8.2 Boots to CLI not to GUI porkchopexpress Linux - Newbie 5 06-22-2005 08:27 AM
changing gui from cli twistedrhymes Linux - Newbie 3 06-14-2005 02:44 AM
Microsoft's CLI: Is it a Bash Clone? ernesto_cgf Linux - News 3 06-13-2005 01:39 AM
can only change network with GUI, not CLI learnfast Linux - Newbie 2 05-03-2005 06:30 AM

All times are GMT -5. The time now is 07:45 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration