Jump to content

Bell character: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Yobot (talk | contribs)
m WP:CHECKWIKI error fixes using AWB (10505)
Usage: Added ANSI-C quoting example
Line 23: Line 23:


echo -e "\a"
echo -e "\a"

and in the [[Bash (Unix shell)|Bash]] shell, one may use ANSI-C quoting:<ref>[http://www.gnu.org/software/bash/manual/bash.html#ANSI_002dC-Quoting ANSI-C quoting]</ref>

echo $'\a'


A program can get the same result by printing the BEL character to a terminal.
A program can get the same result by printing the BEL character to a terminal.

Revision as of 08:45, 21 May 2015

A bell code (sometimes bell character) is a device control code originally sent to ring a small electromechanical bell on tickers and other teleprinters and teletypewriters to alert operators at the other end of the line, often of an incoming message. Though tickers punched the bell codes into their tapes,[1][dead link] printers generally do not print a character when the bell code is received. Bell codes are usually represented by the label "BEL". They have been used since 1870 (initially in Baudot code).[citation needed]

To maintain backward compatibility, video display terminals (VDTs) that replaced teletypewriters included speakers or buzzers to perform the same function, as did the personal computers that followed. Modern terminal emulators often integrate the warnings to the desktop environment (e.g., the Mac OS X Terminal will play the system warning sound) and also often offer a silent visual bell feature that flashes the terminal window briefly.

Representations

In ASCII and Unicode the character with the value 7 is BEL. It can be referred to as control-G or ^G in caret notation. Unicode also includes a character for the visual representation of the bell code, "symbol for bell" (␇) at U+2407.

In the 5-bit Baudot codes, BEL is represented by the number 11 (0x0B) when in "figures" mode. [citation needed]

In the C programming language (created in 1972), the bell character can be placed in a string or character constant with \a. ('a' stands for "alert" or "audible" and was chosen because \b was already used for the backspace character.)

Usage

On Unix-like systems, or on DOS or Windows, a user can cause the equivalent of ringing the bell to happen by typing at the command prompt the command:

echo ^G

where the ^G is produced by holding down Ctrl and typing G. On Unix the user may need to type Ctrl+V first to "quote" the ^G.

On Linux one may also use:

echo -e "\a"

and in the Bash shell, one may use ANSI-C quoting:[2]

echo $'\a'

A program can get the same result by printing the BEL character to a terminal.

On modern systems this may not make a noise, it may instead make a visual indication such as flashing the screen, or do nothing at all.

See also

References

  1. ^ "Baudot". Retrieved February 1, 2009.
  2. ^ ANSI-C quoting