Avatar of tminelgin
tminelgin
 asked on

Audible alarm from Unix shell script

I am running a Putty session on windows XP and I would like my shell script to give me an audible alarm.
ex
run program that produces text line like  job_name job_start Job_status etc.
grep ' FA ' from line and beep.

Is this possible?
Shell ScriptingUnix OS

Avatar of undefined
Last Comment
tminelgin

8/22/2022 - Mon
larsrohr

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".

tminelgin

ASKER
Doesn't seem to work.  The UNIX environment here perhaps doesn't support this.
larsrohr

What unix OS is it?  (uname -a)

What happens at the unix prompt if you just type ctrl-G and hit return?
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
tminelgin

ASKER
AIX and 'ctrl-G' not found
larsrohr

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.
scottbisker

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
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
tminelgin

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
woolmilkporc

echo "\a"
or
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"

wmp
tminelgin

ASKER
tired of asking