Echo

As we've already seen in the first example above, echo is used to display a line of text/string the the standard output (stdout), usually the terminal, or a file.

 

echo "Hello, World!"

 

If you specify the -e option it enables interpretation of the following backslash escaped characters:

Option Description
\\ A literal backslash character ("\")
\a An alert (The BELL character)
\b Backspace
\c Produce no further output after this
\e Escape character; equivalent to pressing the escape key
\f Form feed
-n or \n Newline
\r Carriage return
\t Horizontal tab
\v Vertical tab
\0NNN Byte with octal value NNN (1 to 3 digits)
\xHH Byte with hexadecimal value HH (1 or 2 digits)

 

-E Disables the interpretation of backslash escape sequences. This is the default.