Link to home
Start Free TrialLog in
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?
Avatar of larsrohr
larsrohr
Flag of United States of America image

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

Avatar of tminelgin
tminelgin

ASKER

Doesn't seem to work.  The UNIX environment here perhaps doesn't support this.
What unix OS is it?  (uname -a)

What happens at the unix prompt if you just type ctrl-G and hit return?
AIX and 'ctrl-G' not found
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.
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
ASKER CERTIFIED SOLUTION
Avatar of tminelgin
tminelgin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of 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
tired of asking