bells and beeps

Jim Rogers jimr at hplsdv7.COS.HP.COM
Wed May 15 01:17:53 AEST 1991


>we are novice unix users running a hewlett-packard 9000/835 under
>hp-ux (a berkeley and at &tt unix hybrid. how do we activate
>a keyboard beep from within a korn shell script? the idea is
>to warn users of invalid entries before the screen clears.
>
>your assistance is appreciated.
>
>thanx,
>
>lee ratzan
>univ of medicine and dentistry of nj

The simple answer is to use a control-G.  This will work in most cases.
The more general solution is to use the "tput" command and the terminfo
database (see man pages for "tput (1)" and "terminfo (4)").  The use
of tput allows the user to be on a wide array of terminal types and still
have the desired response by his/her terminal.

For the "beep" use the following mthod in your Korn shell:

beep=`tput bel`
print "${beep}"


Similar capabilities can be defined for text attributes (i.e. bold, normal),
cursor movement (i.e. home cursor, cursor down, cursor up), clear to
end of line or clear to end of screen, and so forth.


Jim Rogers
Hewlett-Packard Company



More information about the Comp.unix.questions mailing list