Audible alarm from Unix shell script

Posted on 2010-11-14
Last Modified: 2012-05-10
I am running a Putty session on windows XP and I would like my shell script to give me an audible alarm.
run program that produces text line like  job_name job_start Job_status etc.
grep ' FA ' from line and beep.

Is this possible?
Question by:tminelgin
LVL 12

Expert Comment

ID: 34133738
Having your script print a ctrl-G (^G) should make your PuTTY terminal beep.

You can adjust your PuTTY settings (category Terminal -> Bell) to change how the beep works for you.  I found the "default system alert sound" to be rather quiet; "Beep using the PC speaker" was a little more noticeable, but you could also set a custom sound.

To have your script do "echo ^G", you may need to type "echo <ctrl>-V<ctrl>-G".


Author Comment

ID: 34141626
Doesn't seem to work.  The UNIX environment here perhaps doesn't support this.
LVL 12

Expert Comment

ID: 34142458
What unix OS is it?  (uname -a)

What happens at the unix prompt if you just type ctrl-G and hit return?
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.


Author Comment

ID: 34145933
AIX and 'ctrl-G' not found
LVL 12

Expert Comment

ID: 34146446
Are you typing "ctrl-G" or are you using the Ctrl key and the G key simultaneously?  The latter is what you want -- just hitting the Ctrl and G keys simultaneously.
As a control character, ctrl-G (or ^G) should make a noise, but not show up as an entered command.

Expert Comment

ID: 34175792
Not sure about AIX, but on linux if you pipe random data to the audio device it gives quite an alarm.

echo "asldfjal;sdfja;lsdfjl;askdfj;alkfdjl;akfdj" > /dev/audio

Accepted Solution

tminelgin earned 0 total points
ID: 34184422
nope, giving up.  Not that important.  BTW hitting cntl G places ^G on the line and when entered throws
"sh ^G not found"
LVL 68

Expert Comment

ID: 34184591
echo "\a"
echo \\a

Works in my Putty session from Windows Vista to AIX with "Terminal" -> "Bell" -> "Make default system alert sound" and "Terminal" -> "Bell" -> "Beep using the PC speaker"


Author Closing Comment

ID: 34216194
tired of asking

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Unix Question 19 50
Unix/bash: scripted arithmetic 13 101
Need to roll back kernel via script 4 86
remove one line from a file in solaris 8 43
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded‚Ķ
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

827 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question