LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 03-30-2004, 06:55 PM   #1
sharpie
Member
 
Registered: Jan 2004
Location: California
Distribution: Slackware 10.1
Posts: 190

Rep: Reputation: 30
.bashrc check if there's a display open


I don't know if this should be here due to the very basicness of it, but I added a command to my .bashrc file:

Code:
xset b off
This turns off beeps in the terminal, the trouble is if I'm in the console I get something like this message everytime I login:

xset: unable to open display.

How can I use a conditional statement to check if a display (X Window) is open:

Code:
if display is open
        xset b off;
fi
Thanks
 
Old 03-30-2004, 06:59 PM   #2
aluser
Member
 
Registered: Mar 2004
Location: Massachusetts
Distribution: Debian
Posts: 557

Rep: Reputation: 43
There might be a better way to do this, but
Code:
if [ "$DISPLAY" ]; then
        xset b off
fi
should work
 
Old 03-30-2004, 07:44 PM   #3
sharpie
Member
 
Registered: Jan 2004
Location: California
Distribution: Slackware 10.1
Posts: 190

Original Poster
Rep: Reputation: 30
Worked, thanks.
 
Old 03-31-2004, 03:43 AM   #4
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
even better, put it in

.xinitrc

which only gets called with X.

or
(man readline, inputrc)
you can make an .inputrc and
turn off all bells.

billy
 
  


Reply



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
How do I start ftp service and check if port open? quintan Linux - Software 2 01-15-2018 02:02 AM
Problem using screen: Cannot open your terminal '/dev/pts/0' - please check. stefaandk Linux - General 18 06-17-2014 07:52 PM
check internet connection in .bashrc mvo Linux - Newbie 2 11-26-2005 06:32 PM
How to check display card? sikandar Linux - Software 1 01-12-2004 06:56 PM
bashrc not read by root, can't open display SerfurJ Slackware 6 12-05-2003 10:54 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:04 PM.

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