LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-04-2011, 03:31 AM   #1
hk_centos
LQ Newbie
 
Registered: Jun 2011
Posts: 22

Rep: Reputation: Disabled
how to play beep sound inside shell script?


Hi All,

I need to make beep sound inside my basic shell script.

ex:
#!/bin/sh

if ping 172.16.XXX.XXX
then
echo " Server is running "
else
#--- make system sound--------

echo " Server idle "
fi

note:
how to check my linux system is working with these system sounds ?

ex :
$] beep

there were no any sound play through speaker
but
system --> preferences--> sound
all testing stages are successful.

Regards,
HK

Last edited by hk_centos; 08-04-2011 at 03:33 AM. Reason: My fault
 
Old 08-04-2011, 04:49 AM   #2
Fantasio
Member
 
Registered: Nov 2007
Location: Vinsobres - Drome - France
Distribution: SuSE Linux 11.3
Posts: 152

Rep: Reputation: 19
aplay is your friend

An alternative is to use "aplay soundfile.wav".
In a shell script, you can use the command echo -e "\a" or the command mentionned just before.
 
Old 08-04-2011, 05:48 AM   #3
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,464

Rep: Reputation: Disabled
This script seems to work (run as root)
Code:
#!/bin/bash
if [ "$1" = on ];then
micro_inetd 55555 $0 &
else
echo -e '\a' >/dev/tty9
fi
More details are found here.
ciao,
jdk
 
Old 08-04-2011, 05:58 AM   #4
salemeni
Member
 
Registered: Aug 2011
Posts: 64

Rep: Reputation: Disabled
Hi
You can use the beep command

ex.

beep -f 300.7 -r 2 -d 100 -l 400

generics array

Last edited by salemeni; 12-06-2011 at 03:50 AM.
 
Old 08-04-2011, 05:02 PM   #5
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,085

Rep: Reputation: 398Reputation: 398Reputation: 398Reputation: 398
beep only works if your PC has a "speaker". Many modern laptops / small devices don't have one.
 
Old 08-05-2011, 02:52 AM   #6
hk_centos
LQ Newbie
 
Registered: Jun 2011
Posts: 22

Original Poster
Rep: Reputation: Disabled
Thanks All for ur suggestions,

Actually i used .wav file to make sound
just putting

if <condition>
then
play xxxxx.wav
fi

i thought why i'm think much about beep sound , i design a my solution using sound file

Best Regards ,
HK
 
  


Reply


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
Executing a Shell script with 654 permissions inside another shell script. changusee2k Linux - Newbie 2 06-07-2011 08:58 PM
How to make my computer beep using terminal shell script? QueenZ Linux - Newbie 4 07-31-2010 06:54 PM
Runs Multiple shell script inside a main script using crontab srimal Linux - Newbie 4 10-22-2009 07:19 PM
Make system bell/beep play through sound card wilson47 Linux - General 5 05-05-2009 04:17 PM
perl inside a shell script baidym Linux - Newbie 2 05-05-2008 07:42 PM


All times are GMT -5. The time now is 12:43 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration