The -n option is used when the termination by a new-line is not wanted. The -n option is a transition aid for BSD applications, and will be removed in a future release.
echo understands the following C-like escape conventions (beware of conflicts with the shell's use of the backslash character):
For example, typing:
echo ´WARNING:\07´
displays the phrase WARNING:
and sounds the bell on your terminal.
The use of single (or double) quotes
(or two backslashes) is required to protect the ``\''
that precedes the ``07''.
Following the ``\0'', up to three digits are used in constructing the octal output character. If, following the \0n, you want to echo additional digits that are not part of the octal representation, you must use the full 3-digit n. For example, if you want to echo ``ESC 7'' you must use the three digits ``033'' rather than just the two digits ``33'' after the ``\0''.
2 digits | Incorrect: | echo "\0337" | od -xc |
produces: |
df0a (hex)
| |
337 (ascii)
| ||
3 digits | Correct: | echo "\00337" | od -xc |
produces: |
lb37 0a00 (hex)
| |
033 7 (ascii)
|
2 digits Incorrect: echo "\0337" | od -xc produces: df0a (hex) 337 (ascii) 3 digits Correct: echo "\00337" | od -xc produces: lb37 0a00 (hex) 033 7 (ascii)