The echo command is a built-in shell command, which is used to display the value of a variable or print a line of text. Echo command plays an important role in building a shell script.
# echo [Options] [String]
The items in square brackets are optional. A string can be defined as a finite sequence of characters (like letters, numerals, symbols punctuation marks).
When echo command is used without any options or strings, echo returns a blank line on the display screen followed by the command prompt on the subsequent line. This is because pressing the ENTER key is a signal to the system to start a new line, and thus echo repeats this signal.
- -n do not output the trailing newline
- -e enable interpretation of backslash escapes
- -E disable interpretation of backslash escapes (default)
If -e is in effect, the following sequences are recognized:
- \ backslash
- a alert (BEL)
- b backspace
- c produce no further output
- e escape
- f form feed
- n new line
- r carriage return
- t horizontal tab
- v vertical tab